From 4118dff509920f909d686e7d1083cb1f03dfb5c4 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Thu, 25 Mar 2021 06:29:40 +0000 Subject: [PATCH 1/2] suspend integration tests: run all subtests in pre-submit Signed-off-by: Adhityaa Chandrasekar --- test/integration/job/job_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/integration/job/job_test.go b/test/integration/job/job_test.go index d1341254741..96db8b1402c 100644 --- a/test/integration/job/job_test.go +++ b/test/integration/job/job_test.go @@ -278,7 +278,6 @@ func TestSuspendJob(t *testing.T) { wantReason string } testCases := []struct { - short bool featureGate bool create step update step @@ -286,7 +285,6 @@ func TestSuspendJob(t *testing.T) { // Exhaustively test all combinations other than trivial true->true and // false->false cases. { - short: true, featureGate: true, create: step{flag: false, wantActive: 2}, update: step{flag: true, wantActive: 0, wantStatus: v1.ConditionTrue, wantReason: "Suspended"}, @@ -311,9 +309,6 @@ func TestSuspendJob(t *testing.T) { for _, tc := range testCases { name := fmt.Sprintf("feature=%v,create=%v,update=%v", tc.featureGate, tc.create.flag, tc.update.flag) t.Run(name, func(t *testing.T) { - if testing.Short() && !tc.short { - t.Skip("skipping expensive subtest") - } defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.SuspendJob, tc.featureGate)() closeFn, restConfig, clientSet, ns := setup(t, "suspend") From 0a21157c96f5a06254f54416419e6abba93da7b3 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Thu, 25 Mar 2021 06:31:35 +0000 Subject: [PATCH 2/2] job controller: don't mutate shared cache object Signed-off-by: Adhityaa Chandrasekar --- pkg/controller/job/job_controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/controller/job/job_controller.go b/pkg/controller/job/job_controller.go index df45826f745..cd50c5f2cdf 100644 --- a/pkg/controller/job/job_controller.go +++ b/pkg/controller/job/job_controller.go @@ -462,7 +462,8 @@ func (jm *Controller) syncJob(key string) (bool, error) { } return false, err } - job := *sharedJob + // make a copy so we don't mutate the shared cache + job := *sharedJob.DeepCopy() // if job was finished previously, we don't want to redo the termination if IsJobFinished(&job) {