mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Add a test that checks if reports with data round-trip
Previously the only roundtrip test was for an empty report. This test has fake data similar to that found in real reports. 'Metrics' does not round-trip exactly, so a DeepEqual workaround is added for that.
This commit is contained in:
@@ -146,6 +146,11 @@ func structEq(v1, v2 reflect.Value, visited map[visit]bool, depth int) bool {
|
||||
if v1.Type().Field(i).Tag.Get("deepequal") == "skip" {
|
||||
continue
|
||||
}
|
||||
if v1.Type().Field(i).Tag.Get("deepequal") == "nil==empty" {
|
||||
if v1.Field(i).IsNil() && v2.Field(i).Len() == 0 || v2.Field(i).IsNil() && v1.Field(i).Len() == 0 {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if !deepValueEqual(v1.Field(i), v2.Field(i), visited, depth+1) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user