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

@@ -178,7 +178,7 @@ func (o replicaSetsByCreationTimestamp) Less(i, j int) bool {
// name. A slice of BASH commands can be supplied as args to be run by the pod
func testDeployment(replicas int32, podLabels map[string]string, nodeSelector map[string]string, namespace string, pvclaims []*v1.PersistentVolumeClaim, securityLevel admissionapi.Level, command string) *appsv1.Deployment {
if len(command) == 0 {
command = "trap exit TERM; while true; do sleep 1; done"
command = e2epod.InfiniteSleepCommand
}
zero := int64(0)
deploymentName := "deployment-" + string(uuid.NewUUID())