Skip to content

Commit ddd95d6

Browse files
committed
fix: skip unused tests for two node
currently for two node fencing we do not support extra workers, skipping these tests for DualReplica topology Signed-off-by: ehila <ehila@redhat.com>
1 parent 3521349 commit ddd95d6

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

test/extended/baremetal/common.go

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"strings"
7+
"sync"
78

89
g "github.com/onsi/ginkgo/v2"
910
o "github.com/onsi/gomega"
@@ -16,17 +17,48 @@ import (
1617
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
1718
)
1819

20+
var (
21+
clusterInfraMu sync.Mutex
22+
clusterInfra *configv1.Infrastructure
23+
clusterInfraFetched bool
24+
)
25+
26+
// clusterInfrastructure returns the cluster Infrastructure object. A successful fetch is cached for
27+
// the rest of the process; if Get fails, nothing is cached and the next call retries.
28+
func clusterInfrastructure(oc *exutil.CLI) (*configv1.Infrastructure, error) {
29+
clusterInfraMu.Lock()
30+
defer clusterInfraMu.Unlock()
31+
if clusterInfraFetched {
32+
return clusterInfra, nil
33+
}
34+
infra, err := oc.AdminConfigClient().ConfigV1().Infrastructures().Get(
35+
context.Background(), "cluster", metav1.GetOptions{})
36+
if err == nil {
37+
clusterInfra = infra
38+
clusterInfraFetched = true
39+
}
40+
return infra, err
41+
}
42+
1943
func skipIfNotBaremetal(oc *exutil.CLI) {
2044
g.By("checking platform type")
2145

22-
infra, err := oc.AdminConfigClient().ConfigV1().Infrastructures().Get(context.Background(), "cluster", metav1.GetOptions{})
46+
infra, err := clusterInfrastructure(oc)
2347
o.Expect(err).NotTo(o.HaveOccurred())
2448

2549
if infra.Status.PlatformStatus.Type != configv1.BareMetalPlatformType {
2650
e2eskipper.Skipf("No baremetal platform detected")
2751
}
2852
}
2953

54+
func skipIfTwoNode(oc *exutil.CLI) {
55+
infra, err := clusterInfrastructure(oc)
56+
o.Expect(err).NotTo(o.HaveOccurred())
57+
if infra.Status.ControlPlaneTopology == configv1.DualReplicaTopologyMode {
58+
e2eskipper.Skipf("This test does not apply to two-node")
59+
}
60+
}
61+
3062
// Starting from 4.10, metal3 resources could be created in the vSphere, OpenStack and None
3163
// Platforms in addition to the Baremetal Platform.
3264
// Starting from 4.12, metal3 resources could be created in the AWS Platform too.
@@ -35,7 +67,7 @@ func skipIfNotBaremetal(oc *exutil.CLI) {
3567
func skipIfUnsupportedPlatformOrConfig(oc *exutil.CLI, dc dynamic.Interface) {
3668
g.By("checking supported platforms")
3769

38-
infra, err := oc.AdminConfigClient().ConfigV1().Infrastructures().Get(context.Background(), "cluster", metav1.GetOptions{})
70+
infra, err := clusterInfrastructure(oc)
3971
o.Expect(err).NotTo(o.HaveOccurred())
4072

4173
switch infra.Status.PlatformStatus.Type {

test/extended/baremetal/high_availability.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var _ = g.Describe("[sig-installer][Feature:baremetal][Serial] Baremetal platfor
3939

4040
g.BeforeEach(func() {
4141
skipIfNotBaremetal(oc)
42+
skipIfTwoNode(oc)
4243
helper = NewBaremetalTestHelper(oc.AdminDynamicClient())
4344
helper.Setup()
4445
})

test/extended/baremetal/hosts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ var _ = g.Describe("[sig-installer][Feature:baremetal][Serial] Baremetal platfor
165165

166166
g.BeforeEach(func() {
167167
skipIfNotBaremetal(oc)
168+
skipIfTwoNode(oc)
168169
helper = NewBaremetalTestHelper(oc.AdminDynamicClient())
169170
helper.Setup()
170171
})

0 commit comments

Comments
 (0)