Adjust HyperV reenlightenment migration functest
Now the test is skipped if TSC frequency is not
exposed on the cluster.
@@ -25,6 +25,8 @@ import (
"strings"
"time"
+ "kubevirt.io/kubevirt/pkg/virt-controller/watch/topology"
+
"kubevirt.io/kubevirt/tests/framework/checks"
. "github.com/onsi/ginkgo/v2"
@@ -75,9 +77,14 @@ var _ = Describe("[Serial][sig-compute]Windows VirtualMachineInstance", func() {
windowsVMI.Spec.Domain.Devices.Interfaces[0].Model = "e1000"
})
- It("should be able to migrate when HyperV reenlightenment is enabled", func() {
- var err error
+ Context("VMI with HyperV reenlightenment enabled", func() {
+ When("TSC frequency is exposed on the cluster", func() {
+ It("should be able to migrate", func() {
+ if !isTSCFrequencyExposed(virtClient) {
+ Skip("TSC frequency is not exposed on the cluster")
+ }
+ var err error
By("Creating a windows VM")
windowsVMI, err = virtClient.VirtualMachineInstance(util.NamespaceTestDefault).Create(windowsVMI)
Expect(err).ToNot(HaveOccurred())
@@ -90,6 +97,8 @@ var _ = Describe("[Serial][sig-compute]Windows VirtualMachineInstance", func() {
By("Checking VMI, confirm migration state")
tests.ConfirmVMIPostMigration(virtClient, windowsVMI, migrationUID)
})
+ })
+ })
Context("with winrm connection", func() {
var winrmcliPod *k8sv1.Pod
@@ -380,3 +389,16 @@ func runCommandAndExpectOutput(virtClient kubecli.KubevirtClient, winrmcliPod *k
return output
}, time.Minute*1, time.Second*10).Should(MatchRegexp(expectedOutputRegex))
}
+
+func isTSCFrequencyExposed(virtClient kubecli.KubevirtClient) bool {
+ nodeList, err := virtClient.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
+ Expect(err).ToNot(HaveOccurred())
+
+ for _, node := range nodeList.Items {
+ if _, isExposed := node.Labels[topology.TSCFrequencyLabel]; isExposed {
+ return true
+ }
+ }
+
+ return false
+}
