Skip to content

Commit

Permalink
check node labels
Browse files Browse the repository at this point in the history
  • Loading branch information
tareqalayan committed Mar 3, 2019
1 parent 47f74aa commit 6fa8171
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions tests/vmi_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,16 +1175,21 @@ var _ = Describe("Configurations", func() {
By("Starting a VirtualMachineInstance")
_, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(cpuVmi)
Expect(err).ToNot(HaveOccurred())
vmiHaveCpuManagerLabel := false
nodeLabels := cpuVmi.GetLabels()
node := tests.WaitForSuccessfulVMIStart(cpuVmi)
Expect(node).ToNot(BeEmpty())

nodeObject, err := virtClient.CoreV1().Nodes().Get(node, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
nodeHaveCpuManagerLabel := false
nodeLabels := nodeObject.GetLabels()

for label, val := range nodeLabels {
if label == "cpumanager" && val == "true" {
vmiHaveCpuManagerLabel = true
nodeHaveCpuManagerLabel = true
break
}
}
Expect(vmiHaveCpuManagerLabel).To(Equal("true"))
Expect(nodeHaveCpuManagerLabel).To(Equal("true"))

By("Checking that the pod QOS is guaranteed")
readyPod := tests.GetRunningPodByVirtualMachineInstance(cpuVmi, tests.NamespaceTestDefault)
Expand Down Expand Up @@ -1243,17 +1248,21 @@ var _ = Describe("Configurations", func() {
By("Starting a VirtualMachineInstance")
_, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(cpuVmi)
Expect(err).ToNot(HaveOccurred())
vmiHaveCpuManagerLabel := false
nodeLabels := cpuVmi.GetLabels()
node := tests.WaitForSuccessfulVMIStart(cpuVmi)
Expect(node).ToNot(BeEmpty())

nodeObject, err := virtClient.CoreV1().Nodes().Get(node, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
nodeHaveCpuManagerLabel := false
nodeLabels := nodeObject.GetLabels()

for label, val := range nodeLabels {
if label == "cpumanager" && val == "true" {
vmiHaveCpuManagerLabel = true
nodeHaveCpuManagerLabel = true
break
}
}
Expect(vmiHaveCpuManagerLabel).To(Equal("false"))

Expect(nodeHaveCpuManagerLabel).To(Equal("false"))

By("Expecting the VirtualMachineInstance console")
expecter, err := tests.LoggedInCirrosExpecter(cpuVmi)
Expand Down Expand Up @@ -1340,30 +1349,40 @@ var _ = Describe("Configurations", func() {
By("Starting a VirtualMachineInstance with dedicated cpus")
_, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(cpuVmi)
Expect(err).ToNot(HaveOccurred())
vmiHaveCpuManagerLabel := false
nodeLabels := cpuVmi.GetLabels()
node := tests.WaitForSuccessfulVMIStart(cpuVmi)
Expect(node).ToNot(BeEmpty())

nodeObject, err := virtClient.CoreV1().Nodes().Get(node, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
nodeHaveCpuManagerLabel := false
nodeLabels := nodeObject.GetLabels()

for label, val := range nodeLabels {
if label == "cpumanager" && val == "true" {
vmiHaveCpuManagerLabel = true
nodeHaveCpuManagerLabel = true
break
}
}
Expect(vmiHaveCpuManagerLabel).To(Equal("false"))
Expect(nodeHaveCpuManagerLabel).To(Equal("false"))

By("Starting a VirtualMachineInstance without dedicated cpus")
_, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(Vmi)
Expect(err).ToNot(HaveOccurred())
vmiHaveCpuManagerLabel = false
nodeLabels = cpuVmi.GetLabels()
node = tests.WaitForSuccessfulVMIStart(cpuVmi)
Expect(node).ToNot(BeEmpty())

nodeObject, err = virtClient.CoreV1().Nodes().Get(node, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
nodeHaveCpuManagerLabel = false
nodeLabels = nodeObject.GetLabels()

for label, val := range nodeLabels {
if label == "cpumanager" && val == "true" {
vmiHaveCpuManagerLabel = true
nodeHaveCpuManagerLabel = true
break
}
}
Expect(vmiHaveCpuManagerLabel).To(Equal("true"))
Expect(nodeHaveCpuManagerLabel).To(Equal("true"))
})
})
})
Expand Down

0 comments on commit 6fa8171

Please sign in to comment.