From 63d64b7108967f5a36bec66349c87d7d50bf431f Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Fri, 6 May 2022 11:18:38 +0200 Subject: [PATCH] integration: migrate preemption tests --- .../scheduler/preemption/main_test.go | 27 +++++++++++++++++++ .../{ => preemption}/preemption_test.go | 22 ++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/integration/scheduler/preemption/main_test.go rename test/integration/scheduler/{ => preemption}/preemption_test.go (98%) diff --git a/test/integration/scheduler/preemption/main_test.go b/test/integration/scheduler/preemption/main_test.go new file mode 100644 index 00000000000..89bded3e3e9 --- /dev/null +++ b/test/integration/scheduler/preemption/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 preemption + +import ( + "testing" + + "k8s.io/kubernetes/test/integration/framework" +) + +func TestMain(m *testing.M) { + framework.EtcdMain(m.Run) +} diff --git a/test/integration/scheduler/preemption_test.go b/test/integration/scheduler/preemption/preemption_test.go similarity index 98% rename from test/integration/scheduler/preemption_test.go rename to test/integration/scheduler/preemption/preemption_test.go index f88a9450913..5fc65ded844 100644 --- a/test/integration/scheduler/preemption_test.go +++ b/test/integration/scheduler/preemption/preemption_test.go @@ -16,7 +16,7 @@ limitations under the License. // This file tests preemption functionality of the scheduler. -package scheduler +package preemption import ( "context" @@ -52,6 +52,26 @@ import ( "k8s.io/utils/pointer" ) +// imported from testutils +var ( + initPausePod = testutils.InitPausePod + createNode = testutils.CreateNode + createPausePod = testutils.CreatePausePod + runPausePod = testutils.RunPausePod + deletePod = testutils.DeletePod + initTest = testutils.InitTestSchedulerWithNS + initTestDisablePreemption = testutils.InitTestDisablePreemption + initDisruptionController = testutils.InitDisruptionController + waitCachedPodsStable = testutils.WaitCachedPodsStable + podIsGettingEvicted = testutils.PodIsGettingEvicted + podUnschedulable = testutils.PodUnschedulable + waitForPDBsStable = testutils.WaitForPDBsStable + waitForPodToScheduleWithTimeout = testutils.WaitForPodToScheduleWithTimeout + waitForPodUnschedulable = testutils.WaitForPodUnschedulable +) + +const filterPluginName = "filter-plugin" + var lowPriority, mediumPriority, highPriority = int32(100), int32(200), int32(300) func waitForNominatedNodeNameWithTimeout(cs clientset.Interface, pod *v1.Pod, timeout time.Duration) error {