From 1e4e0759e88946a183614f94549961e6046075e7 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Sun, 19 Apr 2020 15:08:00 -0400 Subject: [PATCH] test: PriorityClass resource quota tests should not cause preemption During a parallel test run these tests were observed to cause a preemption of another test: ``` Apr 19 16:59:06.749: INFO: At 2020-04-19 16:58:52 +0000 UTC - event for pod-init-b6fbd440-dbc2-454a-b31a-ce44266298d1: {default-scheduler } Scheduled: Successfully assigned e2e-init-container-7691/pod-init-b6fbd440-dbc2-454a-b31a-ce44266298d1 to ip-10-0-148-234.us-west-2.compute.internal Apr 19 16:59:06.750: INFO: At 2020-04-19 16:58:54 +0000 UTC - event for pod-init-b6fbd440-dbc2-454a-b31a-ce44266298d1: {default-scheduler } Preempted: Preempted by e2e-resourcequota-priorityclass-8850/testpod-pclass9 on node ip-10-0-148-234.us-west-2.compute.internal ``` These tests have no need to actually land on a node to validate resource quota and so we can set an impossible scheduling condition. Hopefully we don't have tests that too broadly check impossible scheduling conditions. --- test/e2e/apimachinery/resource_quota.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/e2e/apimachinery/resource_quota.go b/test/e2e/apimachinery/resource_quota.go index c352ba7a6fa..203bd3709ef 100644 --- a/test/e2e/apimachinery/resource_quota.go +++ b/test/e2e/apimachinery/resource_quota.go @@ -1491,6 +1491,11 @@ func newTestPodForQuota(f *framework.Framework, name string, requests v1.Resourc Name: name, }, Spec: v1.PodSpec{ + // prevent disruption to other test workloads in parallel test runs by ensuring the quota + // test pods don't get scheduled onto a node + NodeSelector: map[string]string{ + "x-test.k8s.io/unsatisfiable": "not-schedulable", + }, Containers: []v1.Container{ { Name: "pause", @@ -1512,6 +1517,11 @@ func newTestPodForQuotaWithPriority(f *framework.Framework, name string, request Name: name, }, Spec: v1.PodSpec{ + // prevent disruption to other test workloads in parallel test runs by ensuring the quota + // test pods don't get scheduled onto a node + NodeSelector: map[string]string{ + "x-test.k8s.io/unsatisfiable": "not-schedulable", + }, Containers: []v1.Container{ { Name: "pause",