mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
check test case param instead of feature flag in unit test code
This commit is contained in:
parent
a647f9febb
commit
3a02ecb341
@ -882,7 +882,7 @@ func TestControllerSyncJob(t *testing.T) {
|
|||||||
t.Errorf("Unexpected number of creates. Expected %d, saw %d\n", tc.expectedCreations, len(fakePodControl.Templates))
|
t.Errorf("Unexpected number of creates. Expected %d, saw %d\n", tc.expectedCreations, len(fakePodControl.Templates))
|
||||||
}
|
}
|
||||||
if tc.completionMode == batch.IndexedCompletion {
|
if tc.completionMode == batch.IndexedCompletion {
|
||||||
checkIndexedJobPods(t, &fakePodControl, tc.expectedCreatedIndexes, job.Name)
|
checkIndexedJobPods(t, &fakePodControl, tc.expectedCreatedIndexes, job.Name, tc.podIndexLabelDisabled)
|
||||||
} else {
|
} else {
|
||||||
for _, p := range fakePodControl.Templates {
|
for _, p := range fakePodControl.Templates {
|
||||||
// Fake pod control doesn't add generate name from the owner reference.
|
// Fake pod control doesn't add generate name from the owner reference.
|
||||||
@ -969,12 +969,12 @@ func TestControllerSyncJob(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkIndexedJobPods(t *testing.T, control *controller.FakePodControl, wantIndexes sets.Set[int], jobName string) {
|
func checkIndexedJobPods(t *testing.T, control *controller.FakePodControl, wantIndexes sets.Set[int], jobName string, podIndexLabelDisabled bool) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
gotIndexes := sets.New[int]()
|
gotIndexes := sets.New[int]()
|
||||||
for _, p := range control.Templates {
|
for _, p := range control.Templates {
|
||||||
checkJobCompletionEnvVariable(t, &p.Spec)
|
checkJobCompletionEnvVariable(t, &p.Spec)
|
||||||
if feature.DefaultFeatureGate.Enabled(features.PodIndexLabel) {
|
if !podIndexLabelDisabled {
|
||||||
checkJobCompletionLabel(t, &p)
|
checkJobCompletionLabel(t, &p)
|
||||||
}
|
}
|
||||||
ix := getCompletionIndex(p.Annotations)
|
ix := getCompletionIndex(p.Annotations)
|
||||||
|
Loading…
Reference in New Issue
Block a user