From 14fc90a8f617fa16fb5a279fe4389b40bd283838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Osipiuk?= Date: Thu, 10 May 2018 14:26:54 +0200 Subject: [PATCH] Add framework.GetReadyNodesIncludingTaintedOrDie --- test/e2e/framework/util.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 91e5ba50153..9930bdf1ced 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -2606,6 +2606,18 @@ func GetReadySchedulableNodesOrDie(c clientset.Interface) (nodes *v1.NodeList) { return nodes } +// GetReadyNodesIncludingTaintedOrDie returns all ready nodes, even those which are tainted. +// There are cases when we care about tainted nodes +// E.g. in tests related to nodes with gpu we care about nodes despite +// presence of nvidia.com/gpu=present:NoSchedule taint +func GetReadyNodesIncludingTaintedOrDie(c clientset.Interface) (nodes *v1.NodeList) { + nodes = waitListSchedulableNodesOrDie(c) + FilterNodes(nodes, func(node v1.Node) bool { + return isNodeSchedulable(&node) + }) + return nodes +} + func WaitForAllNodesSchedulable(c clientset.Interface, timeout time.Duration) error { Logf("Waiting up to %v for all (but %d) nodes to be schedulable", timeout, TestContext.AllowedNotReadyNodes)