Skip to content

Commit

Permalink
node_labeller.go: Fix test_id: 6247
Browse files Browse the repository at this point in the history
We are setting kubevirt.configuration.ObsoleteCPUModels
to nil to align with test expectations.
The test assumes that kubevirt.configuration.ObsoleteCPUModels
is not set.

Before this PR, if kubevirt.configuration.ObsoleteCPUModels
was set before the tests started running,
then the test would fail.

After this PR, if kubevirt.configuration.ObsoleteCPUModels
was set before the tests started running, it will be set
to nil to prevent failure.

Additionally, we will wait for 30 seconds before failing
to give the node labeller enough time to set the new
labels on the nodes.

Signed-off-by: bmordeha <bmordeha@redhat.com>
  • Loading branch information
Barakmor1 committed May 5, 2024
1 parent 95435d0 commit fa6953d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/infrastructure/node-labeller.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,23 @@ var _ = DescribeInfra("Node-labeller", func() {
})

It("[test_id:6247] should set default obsolete cpu models filter when obsolete-cpus-models is not set in kubevirt config", func() {
kvConfig := util.GetCurrentKv(virtClient)
kvConfig.Spec.Configuration.ObsoleteCPUModels = nil
tests.UpdateKubeVirtConfigValueAndWait(kvConfig.Spec.Configuration)
node := nodesWithKVM[0]

for key := range node.Labels {
if strings.Contains(key, v1.CPUModelLabel) {
model := strings.TrimPrefix(key, v1.CPUModelLabel)
Expect(nodelabellerutil.DefaultObsoleteCPUModels).ToNot(HaveKey(model),
"Node can't contain label with cpu model, which is in default obsolete filter")
Eventually(func() error {
node, err = virtClient.CoreV1().Nodes().Get(context.Background(), node.Name, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
for key := range node.Labels {
if strings.Contains(key, v1.CPUModelLabel) {
model := strings.TrimPrefix(key, v1.CPUModelLabel)
if _, ok := nodelabellerutil.DefaultObsoleteCPUModels[model]; ok {
return fmt.Errorf("node can't contain label with cpu model, which is in default obsolete filter")
}
}
}
}
return nil
}).WithTimeout(30 * time.Second).WithPolling(1 * time.Second).ShouldNot(HaveOccurred())
})

It("[test_id:6995]should expose tsc frequency and tsc scalability", func() {
Expand Down

0 comments on commit fa6953d

Please sign in to comment.