diff --git a/tests/utils.go b/tests/utils.go index 3f7bd64a1748..85653be8a4c2 100644 --- a/tests/utils.go +++ b/tests/utils.go @@ -592,6 +592,11 @@ func CreateHostPathPvWithSize(osName string, hostPath string, size string) { hostPathType := k8sv1.HostPathDirectoryOrCreate name := fmt.Sprintf("%s-disk-for-tests", osName) + + nodes := GetAllSchedulableNodes(virtCli) + Expect(len(nodes.Items) > 0).To(BeTrue()) + nodeName := nodes.Items[0].Name + pv := &k8sv1.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -620,7 +625,7 @@ func CreateHostPathPvWithSize(osName string, hostPath string, size string) { { Key: "kubernetes.io/hostname", Operator: k8sv1.NodeSelectorOpIn, - Values: []string{"node01"}, + Values: []string{nodeName}, }, }, }, @@ -1550,6 +1555,12 @@ func newBlockVolumePV(name string, labelSelector map[string]string, size string) storageClass := StorageClassBlockVolume volumeMode := k8sv1.PersistentVolumeBlock + virtCli, err := kubecli.GetKubevirtClient() + PanicOnError(err) + + nodes := GetAllSchedulableNodes(virtCli) + Expect(len(nodes.Items) > 0).To(BeTrue()) + nodeName := nodes.Items[0].Name // Note: the path depends on kubevirtci! // It's configured to have a device backed by a cirros image at exactly that place on node01 // And the local storage provider also has access to it @@ -1578,7 +1589,7 @@ func newBlockVolumePV(name string, labelSelector map[string]string, size string) { Key: "kubernetes.io/hostname", Operator: k8sv1.NodeSelectorOpIn, - Values: []string{"node01"}, + Values: []string{nodeName}, }, }, }, diff --git a/tests/vmi_configuration_test.go b/tests/vmi_configuration_test.go index 474b1e3b61b9..e53425c42b23 100644 --- a/tests/vmi_configuration_test.go +++ b/tests/vmi_configuration_test.go @@ -1174,6 +1174,7 @@ var _ = Describe("Configurations", func() { _, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(cpuVmi) Expect(err).ToNot(HaveOccurred()) node := tests.WaitForSuccessfulVMIStart(cpuVmi) + // what should i do here it will always pass for us (false positve) Expect(node).NotTo(ContainSubstring("node01")) By("Checking that the pod QOS is guaranteed") @@ -1234,6 +1235,7 @@ var _ = Describe("Configurations", func() { _, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(cpuVmi) Expect(err).ToNot(HaveOccurred()) node := tests.WaitForSuccessfulVMIStart(cpuVmi) + // what should i do here it will always pass for us (false positve) Expect(node).NotTo(ContainSubstring("node01")) By("Expecting the VirtualMachineInstance console") @@ -1328,6 +1330,7 @@ var _ = Describe("Configurations", func() { _, 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")) }) })