Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 11 additions & 61 deletions test/extended-priv/mco_irreconcilablechanges.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package extended

import (
"fmt"
"strings"

g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
Expand Down Expand Up @@ -77,25 +76,6 @@ func platformBasedDisksNames(platform string) []string {
return []string{}
}

// discoverNVMeByPathDisks discovers the /dev/disk/by-path/ entries for non-boot NVMe
// devices on an AWS node. These PCI-based paths are stable per instance type, unlike
// /dev/nvmeXn1 which depends on device enumeration order.
func discoverNVMeByPathDisks(node *Node) []string {
script := `for p in /dev/disk/by-path/*nvme*; do [[ $p == *part* ]] && continue; ls ${p}-part* &>/dev/null && continue; echo "$p"; done | sort`
stdout, _, err := node.DebugNodeWithChrootStd("bash", "-c", script)
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred(), "Failed to discover NVMe by-path disks on node %s", node.GetName())

var paths []string
for _, line := range strings.Split(strings.TrimSpace(stdout), "\n") {
line = strings.TrimSpace(line)
if line != "" {
paths = append(paths, line)
}
}
logger.Infof("Discovered %d non-boot NVMe by-path disks on node %s: %v", len(paths), node.GetName(), paths)
return paths
}

var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive][Disruptive][OCPFeatureGate:IrreconcilableMachineConfig][Serial]", g.Ordered, func() {
defer g.GinkgoRecover()

Expand Down Expand Up @@ -163,14 +143,17 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive
logger.Infof("All worker nodes have irreconcilable changes as expected!\n")
})

g.It("[PolarionID:84219] Verify irreconcilable changes on new and existing nodes after scale up [Disruptive]", g.Label("Platform:aws", "Platform:gce", "Platform:azure", "Platform:vsphere"), func() {
g.It("[PolarionID:84219] Verify irreconcilable changes on new and existing nodes after scale up [Disruptive]", g.Label("Platform:gce", "Platform:azure"), func() {
var (
machineconfiguration = GetMachineConfiguration(oc)
mcName = "irreconcilable-scaleup-test"
initialMcSpecs = machineconfiguration.GetSpecOrFail()
)

SkipTestIfWorkersCannotBeScaled(oc)
// Only GCPPlatform and AzurePlatform are able to enumerate disks in a reliable manner right now.
// See https://redhat.atlassian.net/browse/MCO-2470
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AzurePlatform)

Comment on lines +146 to +156

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Skip unsupported platforms before checking scalability.

Line 153 runs an assertion-backed scaling capability check on AWS, vSphere, and other unsupported platforms before Line 157 skips them. A WorkersCanBeScaled error therefore fails the test instead of disabling it as intended. Move the platform guard before SkipTestIfWorkersCannotBeScaled.

Proposed fix
-		SkipTestIfWorkersCannotBeScaled(oc)
-
 		// Only GCPPlatform and AzurePlatform are able to enumerate disks in a reliable manner right now.
 		// See https://redhat.atlassian.net/browse/MCO-2470
 		skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AzurePlatform)
+		SkipTestIfWorkersCannotBeScaled(oc)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
g.It("[PolarionID:84219] Verify irreconcilable changes on new and existing nodes after scale up [Disruptive]", g.Label("Platform:gce", "Platform:azure"), func() {
var (
machineconfiguration = GetMachineConfiguration(oc)
mcName = "irreconcilable-scaleup-test"
initialMcSpecs = machineconfiguration.GetSpecOrFail()
)
SkipTestIfWorkersCannotBeScaled(oc)
// Only GCPPlatform and AzurePlatform are able to enumerate disks in a reliable manner right now.
// See https://redhat.atlassian.net/browse/MCO-2470
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AzurePlatform)
g.It("[PolarionID:84219] Verify irreconcilable changes on new and existing nodes after scale up [Disruptive]", g.Label("Platform:gce", "Platform:azure"), func() {
var (
machineconfiguration = GetMachineConfiguration(oc)
mcName = "irreconcilable-scaleup-test"
initialMcSpecs = machineconfiguration.GetSpecOrFail()
)
// Only GCPPlatform and AzurePlatform are able to enumerate disks in a reliable manner right now.
// See https://redhat.atlassian.net/browse/MCO-2470
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AzurePlatform)
SkipTestIfWorkersCannotBeScaled(oc)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/extended-priv/mco_irreconcilablechanges.go` around lines 146 - 158, Move
the skipSupportedPlatformNotMatched call in the irreconcilable scale-up test
before SkipTestIfWorkersCannotBeScaled, so unsupported platforms are skipped
without triggering the scalability assertion; preserve the existing
supported-platform restriction and subsequent test setup.

mcp := NewMachineConfigPool(oc, MachineConfigPoolWorker)

defer func() {
Expand Down Expand Up @@ -204,25 +187,7 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive
err = platformBasedDisksPatch(platform, newMS)
o.Expect(err).NotTo(o.HaveOccurred())

// On AWS, NVMe device enumeration is non-deterministic. Scale up a probe
// node first to discover the stable /dev/disk/by-path/ entries, then use
// those paths in the MachineConfig so Ignition can reliably find the disks.
disks := platformBasedDisksNames(platform)
var probeNode *Node
if platform == AWSPlatform {
exutil.By("Step 2.5: Scale up probe node to discover disk paths")
o.Expect(newMS.ScaleTo(1)).To(o.Succeed())
o.Expect(newMS.WaitUntilReady("10m")).To(o.Succeed())

probeNodes := newMS.GetNodesOrFail()
o.Expect(probeNodes).To(o.HaveLen(1))
probeNode = probeNodes[0]
logger.Infof("Probe node is: %s", probeNode.GetName())

discoveredDisks := discoverNVMeByPathDisks(probeNode)
o.Expect(discoveredDisks).To(o.HaveLen(2), "Expected exactly 2 non-boot NVMe disks on probe node %s", probeNode.GetName())
disks = discoveredDisks
}

mc := NewMachineConfig(oc, mcName, MachineConfigPoolWorker).SetMCOTemplate("extra-disks-with-files.yaml")

Expand Down Expand Up @@ -254,27 +219,12 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive
logger.Infof("All worker nodes report irreconcilable storage changes!\n")

exutil.By("Step 5: Scale up test node with MC applied via Ignition")
var testNode *Node
if platform == AWSPlatform {
o.Expect(newMS.ScaleTo(2)).To(o.Succeed())
o.Expect(newMS.WaitUntilReady("10m")).To(o.Succeed())

allNodes := newMS.GetNodesOrFail()
o.Expect(allNodes).To(o.HaveLen(2))
for _, n := range allNodes {
if n.GetName() != probeNode.GetName() {
testNode = n
}
}
o.Expect(testNode).NotTo(o.BeNil(), "Could not identify test node among scaled-up nodes")
} else {
o.Expect(newMS.ScaleTo(1)).To(o.Succeed())
o.Expect(newMS.WaitUntilReady("10m")).To(o.Succeed())

testNodes := newMS.GetNodesOrFail()
o.Expect(testNodes).To(o.HaveLen(1))
testNode = testNodes[0]
}
o.Expect(newMS.ScaleTo(1)).To(o.Succeed())
o.Expect(newMS.WaitUntilReady("10m")).To(o.Succeed())

testNodes := newMS.GetNodesOrFail()
o.Expect(testNodes).To(o.HaveLen(1))
testNode := testNodes[0]
logger.Infof("Test node is: %s", testNode.GetName())

exutil.By("Step 6: Verify test node has no irreconcilable changes")
Expand Down