fix: flaky getHostIP test

This commit is contained in:
Harshavardhana 2024-04-18 19:09:56 -07:00
parent 01bfdf949a
commit d653a59fc0

View File

@ -147,8 +147,16 @@ func TestGetHostIP(t *testing.T) {
t.Fatalf("error: expected = %v, got = %v", testCase.expectedErr, err) t.Fatalf("error: expected = %v, got = %v", testCase.expectedErr, err)
} }
if testCase.expectedIPList != nil && testCase.expectedIPList.Intersection(ipList).IsEmpty() { if testCase.expectedIPList != nil {
t.Fatalf("host: expected = %v, got = %v", testCase.expectedIPList, ipList) var found bool
for _, ip := range ipList.ToSlice() {
if testCase.expectedIPList.Contains(ip) {
found = true
}
}
if !found {
t.Fatalf("host: expected = %v, got = %v", testCase.expectedIPList, ipList)
}
} }
} }
} }