Skip to content

Commit

Permalink
[tests/e2e]: Fix arping output regex
Browse files Browse the repository at this point in the history
Signed-off-by: Shikhar Soni <[email protected]>
  • Loading branch information
shikharish committed Feb 21, 2024
1 parent 5506dc1 commit b5dfbab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -2201,20 +2201,20 @@ func (data *TestData) forAllMatchingPodsInNamespace(
}

func parseArpingStdout(out string) (sent uint32, received uint32, loss float32, err error) {
re := regexp.MustCompile(`Sent\s+(\d+)\s+probe.*\nReceived\s+(\d+)\s+response`)
re := regexp.MustCompile(`(\d+)\s+packets\s+transmitted,\s+(\d+)\s+packets\s+received,\s+(\d+)%\s+unanswered`)
matches := re.FindStringSubmatch(out)
if len(matches) == 0 {
return 0, 0, 0.0, fmt.Errorf("Unexpected arping output")
}
v, err := strconv.ParseUint(matches[1], 10, 32)
if err != nil {
return 0, 0, 0.0, fmt.Errorf("Error when retrieving 'sent probes' from arpping output: %v", err)
return 0, 0, 0.0, fmt.Errorf("Error when retrieving 'packets transmitted' from arpping output: %v", err)
}
sent = uint32(v)

v, err = strconv.ParseUint(matches[2], 10, 32)
if err != nil {
return 0, 0, 0.0, fmt.Errorf("Error when retrieving 'received responses' from arpping output: %v", err)
return 0, 0, 0.0, fmt.Errorf("Error when retrieving 'packets received' from arpping output: %v", err)
}
received = uint32(v)
loss = 100. * float32(sent-received) / float32(sent)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/wireguard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func testServiceConnectivity(t *testing.T, data *TestData) {
defer cleanup()

// Create the a hostNetwork Pod on a Node different from the service's backend Pod, so the service traffic will be transferred across the tunnel.
require.NoError(t, NewPodBuilder(clientPodName, data.testNamespace, ToolboxImage).OnNode(clientPodNode).WithCommand([]string{"sleep", "3600"}).InHostNetwork().Create(data))
require.NoError(t, NewPodBuilder(clientPodName, data.testNamespace, ToolboxImage).OnNode(clientPodNode).InHostNetwork().Create(data))
defer data.DeletePodAndWait(defaultTimeout, clientPodName, data.testNamespace)
require.NoError(t, data.podWaitForRunning(defaultTimeout, clientPodName, data.testNamespace))

Expand Down

0 comments on commit b5dfbab

Please sign in to comment.