From 9773d896395264670dc97a459f59dc1028356064 Mon Sep 17 00:00:00 2001 From: Tareq Alayan Date: Wed, 27 Feb 2019 11:59:39 +0200 Subject: [PATCH] fix in another place where node name is hardcoded --- tests/vmi_configuration_test.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/vmi_configuration_test.go b/tests/vmi_configuration_test.go index 6f6a3f641a06..caba3c8a1518 100644 --- a/tests/vmi_configuration_test.go +++ b/tests/vmi_configuration_test.go @@ -1132,12 +1132,12 @@ var _ = Describe("Configurations", func() { } nodesWithCPUManager, err := virtClient.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: v1.CPUManager + "=" + "true"}) - Expect(err).ToNot(HaveOccurred()) - Expect(nodesWithCPUManager.Items).NotTo(Equal(0)) + Expect(err).ToNot(HaveOccurred()) + Expect(nodesWithCPUManager.Items).NotTo(Equal(0)) - nodesWithoutCPUManager, err = virtClient.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: v1.CPUManager + "=" + "false"}) - Expect(err).ToNot(HaveOccurred()) - Expect(nodesWithoutCPUManager.Items).NotTo(Equal(0)) + nodesWithoutCPUManager, err = virtClient.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: v1.CPUManager + "=" + "false"}) + Expect(err).ToNot(HaveOccurred()) + Expect(nodesWithoutCPUManager.Items).NotTo(Equal(0)) }) Context("with cpu pinning enabled", func() { It("[test_id:1684]should set the cpumanager label to false when it's not running", func() { @@ -1348,9 +1348,13 @@ var _ = Describe("Configurations", func() { By("Starting a VirtualMachineInstance without dedicated cpus") _, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(Vmi) Expect(err).ToNot(HaveOccurred()) - node1 := tests.WaitForSuccessfulVMIStart(Vmi) - // what should i do here it will always fail for us - Expect(node1).To(ContainSubstring("node02")) + node = tests.WaitForSuccessfulVMIStart(Vmi) + for _, n := range nodesWithCPUManager.Items { + if strings.Contains(node, n.Name) { + Expect(node).To(ContainSubstring(n.Name)) + break + } + } }) }) })