Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karimra committed Apr 25, 2024
1 parent 0363b84 commit 58a4624
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/api/target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"testing"

"github.com/AlekSi/pointer"
"github.com/google/go-cmp/cmp"

"github.com/openconfig/gnmic/pkg/api/types"
)
Expand Down Expand Up @@ -145,7 +144,7 @@ func TestNewTarget(t *testing.T) {
t.Errorf("failed at %q: %v", name, err)
t.Fail()
}
if !cmp.Equal(tg.Config, item.config) {
if tg.Config.String() != item.config.String() {
t.Errorf("failed at %q", name)
t.Errorf("expected %+v", item.config)
t.Errorf(" got %+v", tg.Config)
Expand Down
17 changes: 16 additions & 1 deletion pkg/loaders/loaders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,22 @@ func TestGetInstancesTagsMatches(t *testing.T) {
res := Diff(item.m1, item.m2)
t.Logf("exp value: %+v", item.output)
t.Logf("got value: %+v", res)
if !cmp.Equal(item.output, res) {
if len(item.output.Add) != len(res.Add) {
t.Fail()
}
if len(item.output.Del) != len(res.Del) {
t.Fail()
}
for k, v1 := range item.output.Add {
if v2, ok := res.Add[k]; ok {
if v1.String() != v2.String() {
t.Fail()
}
} else {
t.Fail()
}
}
if !cmp.Equal(item.output.Del, res.Del) {
t.Fail()
}
})
Expand Down

0 comments on commit 58a4624

Please sign in to comment.