Skip to content

Commit

Permalink
report IP families that are being tested
Browse files Browse the repository at this point in the history
Signed-off-by: Pratyay Banerjee <[email protected]>
  • Loading branch information
Neilblaze committed Mar 16, 2023
1 parent eecce64 commit acebe27
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
26 changes: 15 additions & 11 deletions connectivity/tests/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,28 @@ func (s *podToHost) Run(ctx context.Context, t *check.Test) {
node := node

t.ForEachIPFamily(func(ipFam check.IPFamily) {
dstAddrs := []string{}
for _, addr := range node.Status.Addresses {
if check.GetIPFamily(addr.Address) != ipFam {
continue
}
dstAddrs = append(dstAddrs, addr.Address)
}
if len(dstAddrs) == 0 {
return
}

dst := check.ICMPEndpoint("", addr.Address)
ipFam := check.GetIPFamily(addr.Address)

t.NewAction(s, fmt.Sprintf("ping-%d", i), &pod, dst, ipFam).Run(func(a *check.Action) {
a.ExecInPod(ctx, ct.PingCommand(dst, ipFam))
dst := check.ICMPEndpoint("", dstAddrs[0])
msg := fmt.Sprintf("ping-%s-%d", ipFam, i)
t.NewAction(s, msg, &pod, dst, ipFam).Run(func(a *check.Action) {
a.ExecInPod(ctx, ct.PingCommand(dst, ipFam))

a.ValidateFlows(ctx, pod, a.GetEgressRequirements(check.FlowParameters{
Protocol: check.ICMP,
}))
})
a.ValidateFlows(ctx, pod, a.GetEgressRequirements(check.FlowParameters{
Protocol: check.ICMP,
}))
})

i++
}
i++
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion connectivity/tests/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func (s *podToPod) Run(ctx context.Context, t *check.Test) {
continue
}
t.ForEachIPFamily(func(ipFam check.IPFamily) {
t.NewAction(s, fmt.Sprintf("curl-%d", i), &client, echo, ipFam).Run(func(a *check.Action) {
actionDesc := fmt.Sprintf("curl-%s-%d", ipFam.String(), i)
t.NewAction(s, actionDesc, &client, echo, ipFam).Run(func(a *check.Action) {
if s.method == "" {
a.ExecInPod(ctx, ct.CurlCommand(echo, ipFam))
} else {
Expand Down
4 changes: 3 additions & 1 deletion connectivity/tests/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ func (s *podToService) Run(ctx context.Context, t *check.Test) {
continue
}

t.NewAction(s, fmt.Sprintf("curl-%d", i), &pod, svc, check.IPFamilyAny).Run(func(a *check.Action) {
actionDesc := fmt.Sprintf("curl-%s-%d", check.IPFamilyAny, i)

t.NewAction(s, actionDesc, &pod, svc, check.IPFamilyAny).Run(func(a *check.Action) {
a.ExecInPod(ctx, ct.CurlCommand(svc, check.IPFamilyAny))

a.ValidateFlows(ctx, pod, a.GetEgressRequirements(check.FlowParameters{
Expand Down

0 comments on commit acebe27

Please sign in to comment.