Modify functional test
Prove That currently whenever EVMCS HyperV feature
Is not nil in the vm spec than all dependencies
features are enabled.
Even if we set to vmi.Spec.Domain.Features.Hyperv.EVMCS.Enabled
to be false.
@@ -28,6 +28,8 @@ import (
"strings"
"time"
+ "k8s.io/utils/pointer"
+
"kubevirt.io/kubevirt/tests/exec"
"kubevirt.io/kubevirt/tests/framework/checks"
@@ -1157,11 +1159,13 @@ var _ = Describe("[rfe_id:273][crit:high][arm64][vendor:cnv-qe@redhat.com][level
})
- It("the vmi with EVMCS HyperV feature should have correct hyperv and cpu features auto filled", func() {
+ DescribeTable("the vmi with EVMCS HyperV feature should have correct hyperv and cpu features auto filled", func(enabled bool) {
vmi := libvmi.NewCirros()
vmi.Spec.Domain.Features = &v1.Features{
Hyperv: &v1.FeatureHyperv{
- EVMCS: &v1.FeatureState{},
+ EVMCS: &v1.FeatureState{
+ Enabled: pointer.BoolPtr(enabled),
+ },
},
}
@@ -1170,14 +1174,20 @@ var _ = Describe("[rfe_id:273][crit:high][arm64][vendor:cnv-qe@redhat.com][level
vmi, err = virtClient.VirtualMachineInstance(vmi.Namespace).Get(vmi.Name, &metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred(), "Should get VMI")
-
Expect(vmi.Spec.Domain.Features.Hyperv.EVMCS).ToNot(BeNil(), "evmcs should not be nil")
- Expect(vmi.Spec.Domain.Features.Hyperv.VAPIC).ToNot(BeNil(), "vapic should not be nil")
Expect(vmi.Spec.Domain.CPU).ToNot(BeNil(), "cpu topology can't be nil")
+ if enabled {
+ Expect(vmi.Spec.Domain.Features.Hyperv.VAPIC).ToNot(BeNil(), "vapic should not be nil")
Expect(vmi.Spec.Domain.CPU.Features).To(HaveLen(1), "cpu topology has to contain 1 feature")
Expect(vmi.Spec.Domain.CPU.Features[0].Name).To(Equal(nodelabellerutil.VmxFeature), "vmx cpu feature should be requested")
+ } else {
+ Expect(vmi.Spec.Domain.CPU.Features).To(BeEmpty())
+ }
- })
+ },
+ Entry("hyperv and cpu features should be auto filled when EVMCS is enabled", true),
+ Entry("Verify that features aren't applied when enabled is false", false),
+ )
It("[test_id:1640]the vmi with cpu.model that cannot match an nfd label on node should not be scheduled", func() {
vmi := libvmi.NewCirros()
