Our testing infrastructure shouldn't assume anything about the cluster environment.
in these tests we assume that the nodes in the cluster support specific cpuModels,
this might cause failure when using these test outside of kubevirt-ci or when and if
we will modify kubevirt-ci to use different environment.
@@ -932,13 +932,13 @@ var _ = Describe("[rfe_id:273][crit:high][arm64][vendor:cnv-qe@redhat.com][level
Context("[Serial]with default cpu model", func() {
var originalConfig v1.KubeVirtConfiguration
- var defaultCPUModel = "Nehalem"
- var vmiCPUModel = "SandyBridge"
-
+ var supportedCpuModels []string
//store old kubevirt-config
BeforeEach(func() {
// arm64 does not support cpu model
checks.SkipIfARM64(testsuite.Arch, "arm64 does not support cpu model")
+ nodes := libnode.GetAllSchedulableNodes(virtClient)
+ supportedCpuModels = tests.GetSupportedCPUModels(*nodes)
kv := util.GetCurrentKv(virtClient)
originalConfig = kv.Spec.Configuration
})
@@ -949,7 +949,11 @@ var _ = Describe("[rfe_id:273][crit:high][arm64][vendor:cnv-qe@redhat.com][level
})
It("[test_id:3199]should set default cpu model when vmi doesn't have it set", func() {
+ if len(supportedCpuModels) < 1 {
+ Skip("Must have at least one supported cpuModel for this test")
+ }
config := originalConfig.DeepCopy()
+ defaultCPUModel := supportedCpuModels[0]
config.CPUModel = defaultCPUModel
tests.UpdateKubeVirtConfigValueAndWait(*config)
@@ -960,11 +964,16 @@ var _ = Describe("[rfe_id:273][crit:high][arm64][vendor:cnv-qe@redhat.com][level
tests.WaitForSuccessfulVMIStart(vmi)
curVMI, err := virtClient.VirtualMachineInstance(vmi.Namespace).Get(vmi.Name, &metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred(), "Should get VMI")
- Expect(curVMI.Spec.Domain.CPU.Model).To(Equal("Nehalem"), "Expected default CPU model")
+ Expect(curVMI.Spec.Domain.CPU.Model).To(Equal(defaultCPUModel), "Expected default CPU model")
})
It("[test_id:3200]should not set default cpu model when vmi has it set", func() {
+ if len(supportedCpuModels) < 2 {
+ Skip("Must have at least two supported cpuModels for this test")
+ }
+ defaultCPUModel := supportedCpuModels[0]
+ vmiCPUModel := supportedCpuModels[1]
config := originalConfig.DeepCopy()
config.CPUModel = defaultCPUModel
tests.UpdateKubeVirtConfigValueAndWait(*config)
