-
Notifications
You must be signed in to change notification settings - Fork 40k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: split TestCoreResourceEnqueue to deal with the timeout issue
- Loading branch information
1 parent
8fe10dc
commit 429abe3
Showing
8 changed files
with
2,367 additions
and
2,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This test file contains all the tests for the previous requeueing implementation, that is, when QueueingHint isn't implemented, | ||
and it is going to be cleaned up when QueueingHint feature graduates to GA. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package queueing | ||
|
||
import ( | ||
"testing" | ||
|
||
"k8s.io/kubernetes/test/integration/framework" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
framework.EtcdMain(m.Run) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package queueing | ||
|
||
import ( | ||
"testing" | ||
|
||
utilfeature "k8s.io/apiserver/pkg/util/feature" | ||
featuregatetesting "k8s.io/component-base/featuregate/testing" | ||
"k8s.io/kubernetes/pkg/features" | ||
"k8s.io/kubernetes/test/integration/scheduler/queueing" | ||
) | ||
|
||
// TestCoreResourceEnqueueWithQueueingHints verify Pods failed by in-tree default plugins can be | ||
// moved properly upon their registered events. | ||
// Here, we run only the test cases where the EnableSchedulingQueueHint is disabled. | ||
func TestCoreResourceEnqueueWithQueueingHints(t *testing.T) { | ||
for _, tt := range queueing.CoreResourceEnqueueTestCases { | ||
if tt.EnableSchedulingQueueHint != nil && !tt.EnableSchedulingQueueHint.Has(false) { | ||
continue | ||
} | ||
// Note: if EnableSchedulingQueueHint is nil, we assume the test should be run both with/without the feature gate. | ||
|
||
t.Run(tt.Name, func(t *testing.T) { | ||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SchedulerQueueingHints, false) | ||
queueing.RunTestCoreResourceEnqueue(t, tt) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
test/integration/scheduler/queueing/queueinghint/main_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package queueing | ||
|
||
import ( | ||
"testing" | ||
|
||
"k8s.io/kubernetes/test/integration/framework" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
framework.EtcdMain(m.Run) | ||
} |
43 changes: 43 additions & 0 deletions
43
test/integration/scheduler/queueing/queueinghint/queue_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package queueing | ||
|
||
import ( | ||
"testing" | ||
|
||
utilfeature "k8s.io/apiserver/pkg/util/feature" | ||
featuregatetesting "k8s.io/component-base/featuregate/testing" | ||
"k8s.io/kubernetes/pkg/features" | ||
"k8s.io/kubernetes/test/integration/scheduler/queueing" | ||
) | ||
|
||
// TestCoreResourceEnqueue verify Pods failed by in-tree default plugins can be | ||
// moved properly upon their registered events. | ||
// Here, we run only the test cases where the EnableSchedulingQueueHint is enabled. | ||
func TestCoreResourceEnqueue(t *testing.T) { | ||
for _, tt := range queueing.CoreResourceEnqueueTestCases { | ||
if tt.EnableSchedulingQueueHint != nil && !tt.EnableSchedulingQueueHint.Has(true) { | ||
continue | ||
} | ||
// Note: if EnableSchedulingQueueHint is nil, we assume the test should be run both with/without the feature gate. | ||
|
||
t.Run(tt.Name, func(t *testing.T) { | ||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SchedulerQueueingHints, true) | ||
queueing.RunTestCoreResourceEnqueue(t, tt) | ||
}) | ||
} | ||
} |