mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-19 21:39:26 +00:00
Fix tests
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package app_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/weaveworks/scope/app"
|
||||
"github.com/weaveworks/scope/report"
|
||||
"github.com/weaveworks/scope/test"
|
||||
"github.com/weaveworks/scope/test/reflect"
|
||||
)
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"compress/gzip"
|
||||
"encoding/gob"
|
||||
"io"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/weaveworks/scope/report"
|
||||
"github.com/weaveworks/scope/test"
|
||||
"github.com/weaveworks/scope/test/reflect"
|
||||
)
|
||||
|
||||
func TestApply(t *testing.T) {
|
||||
|
||||
@@ -83,8 +83,10 @@ type Report struct {
|
||||
Shortcut bool
|
||||
|
||||
// ID a random identifier for this report, used when caching
|
||||
// rendered views of the report
|
||||
ID string
|
||||
// rendered views of the report. Reports with the same id
|
||||
// must be equal, but we don't require that equal reports have
|
||||
// the same id.
|
||||
ID string `deepequal:"skip"`
|
||||
}
|
||||
|
||||
// MakeReport makes a clean report, ready to Merge() other reports into.
|
||||
|
||||
@@ -105,6 +105,9 @@ func deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, depth int) boo
|
||||
return deepValueEqual(v1.Elem(), v2.Elem(), visited, depth+1)
|
||||
case reflect.Struct:
|
||||
for i, n := 0, v1.NumField(); i < n; i++ {
|
||||
if v1.Type().Field(i).Tag.Get("deepequal") == "skip" {
|
||||
continue
|
||||
}
|
||||
if !deepValueEqual(v1.Field(i), v2.Field(i), visited, depth+1) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user