Skip to content

Commit

Permalink
fix: split TestCoreResourceEnqueue to deal with the timeout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho committed Nov 13, 2024
1 parent 8fe10dc commit 429abe3
Show file tree
Hide file tree
Showing 8 changed files with 2,367 additions and 2,192 deletions.
2 changes: 2 additions & 0 deletions test/integration/scheduler/queueing/former/README.md
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.
27 changes: 27 additions & 0 deletions test/integration/scheduler/queueing/former/main_test.go
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 test/integration/scheduler/queueing/former/queue_test.go
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)
})
}
}
2 changes: 1 addition & 1 deletion test/integration/scheduler/queueing/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package scheduler
package queueing

import (
"testing"
Expand Down
2,223 changes: 2,223 additions & 0 deletions test/integration/scheduler/queueing/queue.go

Large diffs are not rendered by default.

2,192 changes: 1 addition & 2,191 deletions test/integration/scheduler/queueing/queue_test.go

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions test/integration/scheduler/queueing/queueinghint/main_test.go
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 test/integration/scheduler/queueing/queueinghint/queue_test.go
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)
})
}
}

0 comments on commit 429abe3

Please sign in to comment.