@@ -979,28 +979,11 @@ func (tc *testContext) waitUntilDeploymentScaled(name string) error {
979979 return false , nil
980980 })
981981 if err != nil {
982- events , _ := tc .getPodEvents (name )
983- return fmt .Errorf ("error waiting for deployment %v to scale: %v: %w" , deployment , events , err )
982+ return fmt .Errorf ("error waiting for deployment %s to scale: %w" , deployment .Name , err )
984983 }
985984 return nil
986985}
987986
988- // getPodEvents gets all events for any pod with the input in its name. Used for debugging purposes
989- func (tc * testContext ) getPodEvents (name string ) ([]v1.Event , error ) {
990- eventList , err := tc .client .K8s .CoreV1 ().Events (tc .workloadNamespace ).List (context .TODO (), metav1.ListOptions {
991- FieldSelector : "involvedObject.kind=Pod" })
992- if err != nil {
993- return []v1.Event {}, err
994- }
995- var podEvents []v1.Event
996- for _ , event := range eventList .Items {
997- if strings .Contains (event .InvolvedObject .Name , name ) {
998- podEvents = append (podEvents , event )
999- }
1000- }
1001- return podEvents , nil
1002- }
1003-
1004987// createLinuxCurlerJob creates a linux job to curl a specific endpoint. curl must be present in the container image.
1005988func (tc * testContext ) createLinuxCurlerJob (jobSuffix , endpoint string , continuous bool ) (* batchv1.Job , error ) {
1006989 // Retries a failed curl attempt once to avoid flakes
@@ -1125,7 +1108,7 @@ func (tc *testContext) waitUntilJobSucceeds(name string) (string, error) {
11251108 for i := 0 ; i < 60 ; i ++ {
11261109 job , err = tc .client .K8s .BatchV1 ().Jobs (tc .workloadNamespace ).Get (context .TODO (), name , metav1.GetOptions {})
11271110 if err != nil {
1128- return "" , err
1111+ return "" , fmt . Errorf ( "error getting job with name %s: %w" , name , err )
11291112 }
11301113 if ! slices .ContainsFunc (job .Status .Conditions , func (condition batchv1.JobCondition ) bool {
11311114 return condition .Type == batchv1 .JobComplete && condition .Status == v1 .ConditionTrue
@@ -1143,17 +1126,15 @@ func (tc *testContext) waitUntilJobSucceeds(name string) (string, error) {
11431126 return condition .Type == batchv1 .JobSuccessCriteriaMet && condition .Status == v1 .ConditionTrue
11441127 }) {
11451128 // Job did not succeed, return error
1146- events , _ := tc .getPodEvents (name )
1147- return logs , fmt .Errorf ("job %v failed: %v" , job , events )
1129+ return logs , fmt .Errorf ("job %s failed" , name )
11481130 }
11491131 return logs , nil
11501132 }
11511133 _ , err = tc .gatherPodLogs (labelSelector , true )
11521134 if err != nil {
11531135 log .Printf ("Unable to get logs associated with pod %s: %v" , labelSelector , err )
11541136 }
1155- events , _ := tc .getPodEvents (name )
1156- return "" , fmt .Errorf ("job %v timed out: %v" , job , events )
1137+ return "" , fmt .Errorf ("job %s timed out" , name )
11571138}
11581139
11591140// gatherPodLogs writes the logs associated with the label selector of a given pod job or deployment to the Artifacts
0 commit comments