e2e: add TERM trap to pod sleep command

This should avoid the 30s delay caused by shell not responding to SIGTERM, and can only be killed by SIGKILL.

If the pod is deleted with the namespace during cleanup, this also makes cleanup faster, and frees up the resources for the next test cases faster.
This commit is contained in:
胡玮文
2024-06-11 13:45:13 +08:00
parent 9d63e575f8
commit 859bd02593
8 changed files with 18 additions and 20 deletions

View File

@@ -43,11 +43,11 @@ func NodeOSDistroIs(distro string) bool {
return false
}
const InfiniteSleepCommand = "trap exit TERM; while true; do sleep 1; done"
// GenerateScriptCmd generates the corresponding command lines to execute a command.
func GenerateScriptCmd(command string) []string {
var commands []string
commands = []string{"/bin/sh", "-c", command}
return commands
return []string{"/bin/sh", "-c", command}
}
// GetDefaultTestImage returns the default test image based on OS.