Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
GraysonWu committed Oct 3, 2022
1 parent 7be1bb8 commit c30d222
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/e2e/antreapolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,8 @@ sleep 3600
t.Fatalf("Failed to create client Pod: %v", err)
}
defer data.deletePodAndWait(defaultTimeout, clientName, data.testNamespace)
err := data.podWaitForRunning(defaultTimeout, clientName, data.testNamespace)
failOnError(err, t)
ips, err := data.podWaitForIPs(defaultTimeout, clientName, data.testNamespace)
failOnError(err, t)

Expand Down Expand Up @@ -3761,7 +3763,20 @@ sleep 3600
failOnError(waitForResourceReady(t, timeout, acnp), t)
for _, tc := range testcases {
log.Tracef("Probing: %s -> %s:%d", cidr, tc.destAddr, tc.destPort)
connectivity, err := k8sUtils.ProbeAddr(tc.clientPod.Namespace(), "antrea-e2e", tc.clientPod.PodName(), tc.destAddr, tc.destPort, ProtocolTCP)
// Connect to NodePort in the fake external network.
cmd = fmt.Sprintf("for i in $(seq 1 3); do ip netns exec %s /agnhost connect %s:%d --timeout=1s --protocol=tcp; done;", testNetns, tc.destAddr, tc.destPort)
stdout, stderr, err := data.RunCommandFromPod(data.testNamespace, clientName, agnhostContainerName, []string{"sh", "-c", cmd})
connectivity := Connected
if err != nil || stderr != "" {
// log this error as trace since may be an expected failure
log.Tracef("%s -> %s: error when running command: err - %v /// stdout - %s /// stderr - %s", cidr, tc.destAddr, err, stdout, stderr)
// If err != nil and stderr == "", then it means this probe failed because of
// the command instead of connectivity. For example, container name doesn't exist.
if stderr == "" {
connectivity = Error
}
connectivity = DecideProbeResult(stderr, 3)
}
if err != nil {
t.Errorf("failure -- could not complete probe: %v", err)
}
Expand Down

0 comments on commit c30d222

Please sign in to comment.