Skip to content

Commit 429abe3

Browse files
committed
fix: split TestCoreResourceEnqueue to deal with the timeout issue
1 parent 8fe10dc commit 429abe3

File tree

8 files changed

+2367
-2192
lines changed

8 files changed

+2367
-2192
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This test file contains all the tests for the previous requeueing implementation, that is, when QueueingHint isn't implemented,
2+
and it is going to be cleaned up when QueueingHint feature graduates to GA.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package queueing
18+
19+
import (
20+
"testing"
21+
22+
"k8s.io/kubernetes/test/integration/framework"
23+
)
24+
25+
func TestMain(m *testing.M) {
26+
framework.EtcdMain(m.Run)
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package queueing
18+
19+
import (
20+
"testing"
21+
22+
utilfeature "k8s.io/apiserver/pkg/util/feature"
23+
featuregatetesting "k8s.io/component-base/featuregate/testing"
24+
"k8s.io/kubernetes/pkg/features"
25+
"k8s.io/kubernetes/test/integration/scheduler/queueing"
26+
)
27+
28+
// TestCoreResourceEnqueueWithQueueingHints verify Pods failed by in-tree default plugins can be
29+
// moved properly upon their registered events.
30+
// Here, we run only the test cases where the EnableSchedulingQueueHint is disabled.
31+
func TestCoreResourceEnqueueWithQueueingHints(t *testing.T) {
32+
for _, tt := range queueing.CoreResourceEnqueueTestCases {
33+
if tt.EnableSchedulingQueueHint != nil && !tt.EnableSchedulingQueueHint.Has(false) {
34+
continue
35+
}
36+
// Note: if EnableSchedulingQueueHint is nil, we assume the test should be run both with/without the feature gate.
37+
38+
t.Run(tt.Name, func(t *testing.T) {
39+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SchedulerQueueingHints, false)
40+
queueing.RunTestCoreResourceEnqueue(t, tt)
41+
})
42+
}
43+
}

test/integration/scheduler/queueing/main_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package scheduler
17+
package queueing
1818

1919
import (
2020
"testing"

test/integration/scheduler/queueing/queue.go

+2,223
Large diffs are not rendered by default.

test/integration/scheduler/queueing/queue_test.go

+1-2,191
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package queueing
18+
19+
import (
20+
"testing"
21+
22+
"k8s.io/kubernetes/test/integration/framework"
23+
)
24+
25+
func TestMain(m *testing.M) {
26+
framework.EtcdMain(m.Run)
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package queueing
18+
19+
import (
20+
"testing"
21+
22+
utilfeature "k8s.io/apiserver/pkg/util/feature"
23+
featuregatetesting "k8s.io/component-base/featuregate/testing"
24+
"k8s.io/kubernetes/pkg/features"
25+
"k8s.io/kubernetes/test/integration/scheduler/queueing"
26+
)
27+
28+
// TestCoreResourceEnqueue verify Pods failed by in-tree default plugins can be
29+
// moved properly upon their registered events.
30+
// Here, we run only the test cases where the EnableSchedulingQueueHint is enabled.
31+
func TestCoreResourceEnqueue(t *testing.T) {
32+
for _, tt := range queueing.CoreResourceEnqueueTestCases {
33+
if tt.EnableSchedulingQueueHint != nil && !tt.EnableSchedulingQueueHint.Has(true) {
34+
continue
35+
}
36+
// Note: if EnableSchedulingQueueHint is nil, we assume the test should be run both with/without the feature gate.
37+
38+
t.Run(tt.Name, func(t *testing.T) {
39+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SchedulerQueueingHints, true)
40+
queueing.RunTestCoreResourceEnqueue(t, tt)
41+
})
42+
}
43+
}

0 commit comments

Comments
 (0)