Skip to content

Commit

Permalink
Change VerifyIPsWithDig to expect one occurrence of each IP
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Dec 15, 2023
1 parent b1b38f7 commit 25f89fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,13 @@ func (f *Framework) VerifyIPsWithDig(cluster framework.ClusterIndex, service *v1
return false, fmt.Sprintf("expected execution result %q to be empty", result), nil
}
for _, ip := range ipList {
doesContain := strings.Contains(result.(string), ip)
if doesContain && !shouldContain {
count := strings.Count(result.(string), ip)
if count > 0 && !shouldContain {
return false, fmt.Sprintf("expected execution result %q not to contain %q", result, ip), nil
}

if !doesContain && shouldContain {
return false, fmt.Sprintf("expected execution result %q to contain %q", result, ip), nil
if count != 1 && shouldContain {
return false, fmt.Sprintf("expected execution result %q to contain one occurrence of %q", result, ip), nil
}
}

Expand Down

0 comments on commit 25f89fe

Please sign in to comment.