check which node according to lable CpuManager
@@ -1121,12 +1121,23 @@ var _ = Describe("Configurations", func() {
})
Describe("[rfe_id:897][crit:medium][vendor:cnv-qe@redhat.com][level:component]VirtualMachineInstance with CPU pinning", func() {
var nodes *kubev1.NodeList
+ var nodesWithCPUManager *kubev1.NodeList
+ var nodesWithoutCPUManager *kubev1.NodeList
+
BeforeEach(func() {
nodes, err = virtClient.CoreV1().Nodes().List(metav1.ListOptions{})
tests.PanicOnError(err)
if len(nodes.Items) == 1 {
Skip("Skip cpu pinning test that requires multiple nodes when only one node is present.")
}
+
+ nodesWithCPUManager, err := virtClient.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: v1.CPUManager + "=" + "true"})
+ 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))
})
Context("with cpu pinning enabled", func() {
It("[test_id:1684]should set the cpumanager label to false when it's not running", func() {
@@ -1174,8 +1185,10 @@ 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"))
+
+ for _, n := range nodesWithoutCPUManager.Items {
+ Expect(node).ToNot(ContainSubstring(n.Name))
+ }
By("Checking that the pod QOS is guaranteed")
readyPod := tests.GetRunningPodByVirtualMachineInstance(cpuVmi, tests.NamespaceTestDefault)
@@ -1235,8 +1248,9 @@ 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"))
+ for _, n := range nodesWithoutCPUManager.Items {
+ Expect(node).ToNot(ContainSubstring(n.Name))
+ }
By("Expecting the VirtualMachineInstance console")
expecter, err := tests.LoggedInCirrosExpecter(cpuVmi)
@@ -1324,7 +1338,12 @@ var _ = Describe("Configurations", func() {
_, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(cpuVmi)
Expect(err).ToNot(HaveOccurred())
node := tests.WaitForSuccessfulVMIStart(cpuVmi)
- Expect(node).To(ContainSubstring("node02"))
+ for _, n := range nodesWithCPUManager.Items {
+ if strings.Contains(node, n.Name) {
+ Expect(node).To(ContainSubstring(n.Name))
+ break
+ }
+ }
By("Starting a VirtualMachineInstance without dedicated cpus")
_, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(Vmi)
