@@ -12,7 +12,6 @@ import (
1212
1313 . "github.com/onsi/ginkgo/v2"
1414 . "github.com/onsi/gomega"
15-
1615 appsv1 "k8s.io/api/apps/v1"
1716 corev1 "k8s.io/api/core/v1"
1817 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -41,6 +40,7 @@ import (
4140 testclient "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/client"
4241 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/deployments"
4342 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/images"
43+ "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/infrastructure"
4444 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/label"
4545 testlog "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/log"
4646 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/mcps"
@@ -293,7 +293,13 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
293293 profile , err := profiles .GetByNodeLabels (testutils .NodeSelectorLabels )
294294 Expect (err ).ToNot (HaveOccurred ())
295295 ctx := context .Background ()
296+ hasBaremetal := false
296297 for _ , cnfnode := range workerRTNodes {
298+ isVM , err := infrastructure .IsVM (ctx , & cnfnode )
299+ Expect (err ).ToNot (HaveOccurred ())
300+ if ! isVM {
301+ hasBaremetal = true
302+ }
297303 numaInfo , err := nodes .GetNumaNodes (ctx , & cnfnode )
298304 Expect (err ).ToNot (HaveOccurred (), "Unable to get numa information from the node" )
299305 if len (numaInfo ) < 2 {
@@ -310,6 +316,9 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
310316 Skip ("This test requires systems where L3 cache is shared amount subset of cpus" )
311317 }
312318 }
319+ if ! hasBaremetal {
320+ Skip ("Skipping test. All workers in this test setup are VMs, no baremetal node was found" )
321+ }
313322 // Modify the profile such that we give 1 whole ccx to reserved cpus
314323 By ("Modifying the profile" )
315324 isolated = totalOnlineCpus .Difference (reserved )
@@ -555,6 +564,21 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
555564 })
556565
557566 Context ("With Multiple Pods" , func () {
567+ BeforeEach (func () {
568+ hasBaremetal := false
569+ for i := range workerRTNodes {
570+ isVM , err := infrastructure .IsVM (context .Background (), & workerRTNodes [i ])
571+ Expect (err ).ToNot (HaveOccurred ())
572+ if ! isVM {
573+ hasBaremetal = true
574+ break
575+ }
576+ }
577+ if ! hasBaremetal {
578+ Skip ("Skipping test. All workers in this test setup are VMs, no baremetal node was found" )
579+ }
580+ })
581+
558582 type L3UncoreCacheShareMode string
559583 const (
560584 L3UncoreCacheShareEqual L3UncoreCacheShareMode = "equal"
@@ -652,6 +676,21 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
652676 })
653677
654678 Context ("Multiple Containers" , func () {
679+ BeforeEach (func () {
680+ hasBaremetal := false
681+ for i := range workerRTNodes {
682+ isVM , err := infrastructure .IsVM (context .Background (), & workerRTNodes [i ])
683+ Expect (err ).ToNot (HaveOccurred ())
684+ if ! isVM {
685+ hasBaremetal = true
686+ break
687+ }
688+ }
689+ if ! hasBaremetal {
690+ Skip ("Skipping test. All workers in this test setup are VMs, no baremetal node was found" )
691+ }
692+ })
693+
655694 type alignment string
656695 const (
657696 partialAlignment alignment = "partial"
@@ -777,7 +816,13 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
777816 profile , err := profiles .GetByNodeLabels (testutils .NodeSelectorLabels )
778817 Expect (err ).ToNot (HaveOccurred ())
779818 ctx := context .Background ()
819+ hasBaremetal := false
780820 for _ , cnfnode := range workerRTNodes {
821+ isVM , err := infrastructure .IsVM (ctx , & cnfnode )
822+ Expect (err ).ToNot (HaveOccurred ())
823+ if ! isVM {
824+ hasBaremetal = true
825+ }
781826 numaInfo , err := nodes .GetNumaNodes (ctx , & cnfnode )
782827 Expect (err ).ToNot (HaveOccurred (), "Unable to fetch numa nodes" )
783828 coresiblings , err := nodes .GetCoreSiblings (ctx , & cnfnode )
@@ -800,6 +845,9 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
800845 }
801846 Expect (err ).ToNot (HaveOccurred ())
802847 }
848+ if ! hasBaremetal {
849+ Skip ("Skipping test. All workers in this test setup are VMs, no baremetal node was found" )
850+ }
803851 node0 := cpuset .New (nosmt [0 ]... )
804852 node1 := cpuset .New (nosmt [1 ]... )
805853 reserved = cpuset .New (nosmt [0 ][:4 ]... )
@@ -950,7 +998,19 @@ var _ = Describe("[rfe_id:77446] LLC-aware cpu pinning", Label(string(label.Open
950998 })
951999
9521000 BeforeEach (func () {
953- targetNodeName = workerRTNodes [0 ].Name // pick random node
1001+ targetNodeName = ""
1002+ for i := range workerRTNodes {
1003+ workerRT := & workerRTNodes [i ]
1004+ isVM , err := infrastructure .IsVM (context .TODO (), workerRT )
1005+ Expect (err ).ToNot (HaveOccurred ())
1006+ if ! isVM {
1007+ targetNodeName = workerRT .Name
1008+ break
1009+ }
1010+ }
1011+ if targetNodeName == "" {
1012+ Skip ("Skipping test. All workers in this test setup are VMs, no baremetal node was found" )
1013+ }
9541014 var ok bool
9551015 targetNodeInfo , ok = machineDatas [targetNodeName ]
9561016 Expect (ok ).To (BeTrue (), "unknown machine data for node %q" , targetNodeName )
0 commit comments