Skip to content

Commit

Permalink
[e2e tests] Remove explicit sleep command for toolbox containers (#6021)
Browse files Browse the repository at this point in the history
An explicit sleep is not required as the default command in the
container is already "pause".
The Windows version of the toolbox image will not start when using
"sleep", as the command is not available.
Even on Linux, pause is superior to sleep for signal handling.

We also fix the "don't fragment" ping option for Windows.

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas authored and tnqn committed Mar 25, 2024
1 parent 17c279b commit e5c7bd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/e2e/connectivity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func testHostPortPodConnectivity(t *testing.T, data *TestData) {
// alternating in this podInfo slice so that the test can cover different connectivity cases between different OSes.
func createPodsOnDifferentNodes(t *testing.T, data *TestData, namespace, tag string) (podInfos []podInfo, cleanup func() error) {
dsName := "connectivity-test" + tag
_, deleteDaemonSet, err := data.createDaemonSet(dsName, namespace, toolboxContainerName, toolboxImage, []string{"sleep", "3600"}, nil)
_, deleteDaemonSet, err := data.createDaemonSet(dsName, namespace, toolboxContainerName, toolboxImage, nil, nil)
if err != nil {
t.Fatalf("Error when creating DaemonSet '%s': %v", dsName, err)
}
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ func (data *TestData) createMcJoinPodOnNode(name string, ns string, nodeName str
// createToolboxPodOnNode creates a Pod in the test namespace with a single toolbox container. The
// Pod will be scheduled on the specified Node (if nodeName is not empty).
func (data *TestData) createToolboxPodOnNode(name string, ns string, nodeName string, hostNetwork bool) error {
return NewPodBuilder(name, ns, toolboxImage).OnNode(nodeName).WithCommand([]string{"sleep", "3600"}).WithHostNetwork(hostNetwork).Create(data)
return NewPodBuilder(name, ns, toolboxImage).OnNode(nodeName).WithHostNetwork(hostNetwork).Create(data)
}

// createNginxPodOnNode creates a Pod in the test namespace with a single nginx container. The
Expand Down Expand Up @@ -3040,7 +3040,11 @@ func getPingCommand(count int, size int, os string, ip *net.IP, dontFragment boo
cmd = append(cmd, sizeOption, strconv.Itoa(size))
}
if dontFragment {
cmd = append(cmd, "-M", "do")
if os == "windows" {
cmd = append(cmd, "-f")
} else {
cmd = append(cmd, "-M", "do")
}
}

if ip.To4() != nil {
Expand Down

0 comments on commit e5c7bd2

Please sign in to comment.