@@ -82,25 +82,12 @@ func PrepareContainerKill(experimentsDetails *experimentTypes.ExperimentDetails,
8282 return errors .Errorf ("helper pod is not in running state, err: %v" , err )
8383 }
8484
85- // Recording the chaos start timestamp
86- ChaosStartTimeStamp := time .Now ().Unix ()
87-
8885 // Wait till the completion of the helper pod
8986 // set an upper limit for the waiting time
9087 log .Info ("[Wait]: waiting till the completion of the helper pod" )
91- err = status .WaitForCompletion (experimentsDetails .ChaosNamespace , "name=container-kill-" + experimentsDetails .RunID , clients , experimentsDetails .ChaosDuration + experimentsDetails .ChaosInterval + 60 )
92- if err != nil {
93- return err
94- }
95-
96- //ChaosCurrentTimeStamp contains the current timestamp
97- ChaosCurrentTimeStamp := time .Now ().Unix ()
98- //ChaosDiffTimeStamp contains the difference of current timestamp and start timestamp
99- //It will helpful to track the total chaos duration
100- chaosDiffTimeStamp := ChaosCurrentTimeStamp - ChaosStartTimeStamp
101-
102- if int (chaosDiffTimeStamp ) < experimentsDetails .ChaosDuration {
103- return errors .Errorf ("The helper pod failed, check the logs of helper pod for more details" )
88+ podStatus , err := status .WaitForCompletion (experimentsDetails .ChaosNamespace , "name=container-kill-" + experimentsDetails .RunID , clients , experimentsDetails .ChaosDuration + experimentsDetails .ChaosInterval + 60 )
89+ if err != nil || podStatus == "Failed" {
90+ return errors .Errorf ("helper pod failed due to, err: %v" , err )
10491 }
10592
10693 //Deleting the helper pod for container-kill chaos
0 commit comments