Skip to content

Commit

Permalink
internal/host/plugin: fix flaky test
Browse files Browse the repository at this point in the history
Hosts contain IP addresses in string form, whose
order is not defined.
  • Loading branch information
johanbrandhorst committed Sep 7, 2024
1 parent a16a13c commit f980ca9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/host/plugin/repository_host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func TestJob_UpsertHosts(t *testing.T) {
cmpopts.SortSlices(func(x, y *Host) bool {
return x.GetPublicId() < y.GetPublicId()
}),
cmpopts.SortSlices(func(x, y string) bool {
return x < y
}),
),
)

Expand All @@ -242,6 +245,9 @@ func TestJob_UpsertHosts(t *testing.T) {
cmpopts.SortSlices(func(x, y *Host) bool {
return x.GetPublicId() < y.GetPublicId()
}),
cmpopts.SortSlices(func(x, y string) bool {
return x < y
}),
),
)
plg := plg
Expand Down Expand Up @@ -274,6 +280,9 @@ func TestJob_UpsertHosts(t *testing.T) {
got,
cmpopts.IgnoreUnexported(Host{}, store.Host{}),
cmpopts.IgnoreTypes(&timestamp.Timestamp{}),
cmpopts.SortSlices(func(x, y string) bool {
return x < y
}),
),
)
assert.Empty(
Expand Down

0 comments on commit f980ca9

Please sign in to comment.