Skip to content

Commit 0c51600

Browse files
Merge pull request #29807 from eggfoobar/fencing-baremetal-update
OCPBUGS-56381: feat: update test to account for two node fencing
2 parents f9cba4b + 0c68cf9 commit 0c51600

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

test/extended/baremetal/hosts.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,29 @@ var _ = g.Describe("[sig-installer][Feature:baremetal] Baremetal platform should
4141
defer g.GinkgoRecover()
4242

4343
oc := exutil.NewCLI("baremetal")
44+
isTNFDeployment := false
4445

4546
g.BeforeEach(func() {
4647
skipIfNotBaremetal(oc)
48+
isTNFDeployment = exutil.IsTwoNodeFencing(context.TODO(), oc.AdminConfigClient())
4749
})
4850

4951
g.It("have baremetalhost resources", func() {
5052
dc := oc.AdminDynamicClient()
5153
bmc := baremetalClient(dc)
5254

55+
// In TNF Deployments we expect baremetal installs to be detached.
56+
expectedOperationalStatus := "OK"
57+
if isTNFDeployment {
58+
expectedOperationalStatus = "detached"
59+
}
60+
5361
hosts, err := bmc.List(context.Background(), metav1.ListOptions{})
5462
o.Expect(err).NotTo(o.HaveOccurred())
5563
o.Expect(hosts.Items).ToNot(o.BeEmpty())
5664

5765
for _, h := range hosts.Items {
58-
expectStringField(h, "baremetalhost", "status.operationalStatus").To(o.BeEquivalentTo("OK"))
66+
expectStringField(h, "baremetalhost", "status.operationalStatus").To(o.BeEquivalentTo(expectedOperationalStatus))
5967
expectStringField(h, "baremetalhost", "status.provisioning.state").To(o.Or(o.BeEquivalentTo("provisioned"), o.BeEquivalentTo("externally provisioned")))
6068
expectBoolField(h, "baremetalhost", "spec.online").To(o.BeTrue())
6169

test/extended/util/framework.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,15 @@ func IsMicroShiftCluster(kubeClient k8sclient.Interface) (bool, error) {
23282328
return true, nil
23292329
}
23302330

2331+
func IsTwoNodeFencing(ctx context.Context, configClient clientconfigv1.Interface) bool {
2332+
infrastructure, err := configClient.ConfigV1().Infrastructures().Get(ctx, "cluster", metav1.GetOptions{})
2333+
if err != nil {
2334+
return false
2335+
}
2336+
2337+
return infrastructure.Status.ControlPlaneTopology == configv1.DualReplicaTopologyMode
2338+
}
2339+
23312340
func groupName(groupVersionName string) string {
23322341
return strings.Split(groupVersionName, "/")[0]
23332342
}

0 commit comments

Comments
 (0)