From 6a64e24cfaff49803642b2095d31f47f343b40f9 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Fri, 6 May 2022 11:08:12 +0200 Subject: [PATCH] integration: migrate plugings tests --- .../filters_test.go} | 16 ++++++++++- .../scheduler/filters/main_test.go | 27 +++++++++++++++++++ .../scheduler/plugins/main_test.go | 27 +++++++++++++++++++ .../plugins_test.go} | 15 ++++++++++- 4 files changed, 83 insertions(+), 2 deletions(-) rename test/integration/scheduler/{predicates_test.go => filters/filters_test.go} (98%) create mode 100644 test/integration/scheduler/filters/main_test.go create mode 100644 test/integration/scheduler/plugins/main_test.go rename test/integration/scheduler/{framework_test.go => plugins/plugins_test.go} (99%) diff --git a/test/integration/scheduler/predicates_test.go b/test/integration/scheduler/filters/filters_test.go similarity index 98% rename from test/integration/scheduler/predicates_test.go rename to test/integration/scheduler/filters/filters_test.go index 90e8a78155c..bdfcc66dd66 100644 --- a/test/integration/scheduler/predicates_test.go +++ b/test/integration/scheduler/filters/filters_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package scheduler +package filters import ( "context" @@ -36,6 +36,20 @@ import ( "k8s.io/utils/pointer" ) +var ( + createPausePod = testutils.CreatePausePod + initPausePod = testutils.InitPausePod + getPod = testutils.GetPod + deletePod = testutils.DeletePod + initTest = testutils.InitTestSchedulerWithNS + createAndWaitForNodesInCache = testutils.CreateAndWaitForNodesInCache + createNamespacesWithLabels = testutils.CreateNamespacesWithLabels + podUnschedulable = testutils.PodUnschedulable + createNode = testutils.CreateNode + podScheduledIn = testutils.PodScheduledIn + waitForPodUnschedulable = testutils.WaitForPodUnschedulable +) + // This file tests the scheduler predicates functionality. const pollInterval = 100 * time.Millisecond diff --git a/test/integration/scheduler/filters/main_test.go b/test/integration/scheduler/filters/main_test.go new file mode 100644 index 00000000000..db4c6335f74 --- /dev/null +++ b/test/integration/scheduler/filters/main_test.go @@ -0,0 +1,27 @@ +/* +Copyright 2022 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 filters + +import ( + "testing" + + "k8s.io/kubernetes/test/integration/framework" +) + +func TestMain(m *testing.M) { + framework.EtcdMain(m.Run) +} diff --git a/test/integration/scheduler/plugins/main_test.go b/test/integration/scheduler/plugins/main_test.go new file mode 100644 index 00000000000..ba14a88af48 --- /dev/null +++ b/test/integration/scheduler/plugins/main_test.go @@ -0,0 +1,27 @@ +/* +Copyright 2022 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 plugins + +import ( + "testing" + + "k8s.io/kubernetes/test/integration/framework" +) + +func TestMain(m *testing.M) { + framework.EtcdMain(m.Run) +} diff --git a/test/integration/scheduler/framework_test.go b/test/integration/scheduler/plugins/plugins_test.go similarity index 99% rename from test/integration/scheduler/framework_test.go rename to test/integration/scheduler/plugins/plugins_test.go index b8faeee5a5f..b2b944213ba 100644 --- a/test/integration/scheduler/framework_test.go +++ b/test/integration/scheduler/plugins/plugins_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package scheduler +package plugins import ( "context" @@ -47,6 +47,19 @@ import ( "k8s.io/utils/pointer" ) +// imported from testutils +var ( + createPausePod = testutils.CreatePausePod + initPausePod = testutils.InitPausePod + getPod = testutils.GetPod + deletePod = testutils.DeletePod + podUnschedulable = testutils.PodUnschedulable + podSchedulingError = testutils.PodSchedulingError + createAndWaitForNodesInCache = testutils.CreateAndWaitForNodesInCache + waitForPodUnschedulable = testutils.WaitForPodUnschedulable + waitForPodToScheduleWithTimeout = testutils.WaitForPodToScheduleWithTimeout +) + type PreFilterPlugin struct { numPreFilterCalled int failPreFilter bool