mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #100553 from adtac/suspend-intfail
job controller: don't mutate shared cache object
This commit is contained in:
commit
4333e5caa7
@ -462,7 +462,8 @@ func (jm *Controller) syncJob(key string) (bool, error) {
|
|||||||
}
|
}
|
||||||
return false, err
|
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 job was finished previously, we don't want to redo the termination
|
||||||
if IsJobFinished(&job) {
|
if IsJobFinished(&job) {
|
||||||
|
@ -278,7 +278,6 @@ func TestSuspendJob(t *testing.T) {
|
|||||||
wantReason string
|
wantReason string
|
||||||
}
|
}
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
short bool
|
|
||||||
featureGate bool
|
featureGate bool
|
||||||
create step
|
create step
|
||||||
update step
|
update step
|
||||||
@ -286,7 +285,6 @@ func TestSuspendJob(t *testing.T) {
|
|||||||
// Exhaustively test all combinations other than trivial true->true and
|
// Exhaustively test all combinations other than trivial true->true and
|
||||||
// false->false cases.
|
// false->false cases.
|
||||||
{
|
{
|
||||||
short: true,
|
|
||||||
featureGate: true,
|
featureGate: true,
|
||||||
create: step{flag: false, wantActive: 2},
|
create: step{flag: false, wantActive: 2},
|
||||||
update: step{flag: true, wantActive: 0, wantStatus: v1.ConditionTrue, wantReason: "Suspended"},
|
update: step{flag: true, wantActive: 0, wantStatus: v1.ConditionTrue, wantReason: "Suspended"},
|
||||||
@ -311,9 +309,6 @@ func TestSuspendJob(t *testing.T) {
|
|||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
name := fmt.Sprintf("feature=%v,create=%v,update=%v", tc.featureGate, tc.create.flag, tc.update.flag)
|
name := fmt.Sprintf("feature=%v,create=%v,update=%v", tc.featureGate, tc.create.flag, tc.update.flag)
|
||||||
t.Run(name, func(t *testing.T) {
|
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)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.SuspendJob, tc.featureGate)()
|
||||||
|
|
||||||
closeFn, restConfig, clientSet, ns := setup(t, "suspend")
|
closeFn, restConfig, clientSet, ns := setup(t, "suspend")
|
||||||
|
Loading…
Reference in New Issue
Block a user