Skip to content

Commit

Permalink
Merge pull request kubevirt#4426 from stu-gott/selected-node
Browse files Browse the repository at this point in the history
Infra test made invalid assumptions about cluster composition
  • Loading branch information
kubevirt-bot authored Oct 29, 2020
2 parents 20dde21 + 5ec0c43 commit 72e8872
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/infra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,24 @@ var _ = Describe("[Serial]Infrastructure", func() {
// tolerate this taint because it is meant to be used on compute nodes only. If we set this taint
// on a master node, we risk in breaking the test cluster.
for _, pod := range pods.Items {
node := schedulableNodes[pod.Spec.NodeName]
node, ok := schedulableNodes[pod.Spec.NodeName]
if !ok {
// Pod is running on a non-schedulable node?
continue
}
if _, isMaster := node.Labels["node-role.kubernetes.io/master"]; isMaster {
continue
}
selectedNodeName = node.Name
break
}

// It is possible to run this test on a cluster that simply does not have worker nodes.
// Since KubeVirt can't control that, the only correct action is to halt the test.
if selectedNodeName == "" {
Skip("Could nould determine a node to safely taint")
}

By("setting up a watch for terminated pods")
lw, err := virtClient.CoreV1().Pods(flags.KubeVirtInstallNamespace).Watch(metav1.ListOptions{})
Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit 72e8872

Please sign in to comment.