-
Notifications
You must be signed in to change notification settings - Fork 129
e2e: Add ARM kernel boot parameter validation (iommu) #1539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||||||||
| package __arm | ||||||||||||
|
|
||||||||||||
| import ( | ||||||||||||
| "context" | ||||||||||||
|
|
||||||||||||
| corev1 "k8s.io/api/core/v1" | ||||||||||||
|
|
||||||||||||
| . "github.com/onsi/ginkgo/v2" | ||||||||||||
| . "github.com/onsi/gomega" | ||||||||||||
|
|
||||||||||||
| testutils "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils" | ||||||||||||
| "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/infrastructure" | ||||||||||||
| "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/label" | ||||||||||||
| "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/nodes" | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| // TODO: verify label.OpenShift is required — used by other 14_arm files but unclear what filters depend on it | ||||||||||||
| // TODO: verify if label.SpecializedHardware should be added — other 14_arm files use it | ||||||||||||
| var _ = Describe("kernel boot parameters validation on aarch64", Ordered, Label(string(label.OpenShift), string(label.ARM)), func() { | ||||||||||||
| var ( | ||||||||||||
| workerRTNodes []corev1.Node | ||||||||||||
| ctx context.Context | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| BeforeAll(func() { | ||||||||||||
| ctx = context.Background() | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add timeout to context for command execution. The background context has no timeout. If ⏱️ Proposed fix to add timeout BeforeAll(func() {
- ctx = context.Background()
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
+ DeferCleanup(cancel)
var err errorNote: You'll need to add Based on learnings: Ginkgo tests should have appropriate timeouts on cluster operations. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| var err error | ||||||||||||
|
|
||||||||||||
| workerRTNodes, err = nodes.GetByLabels(testutils.NodeSelectorLabels) | ||||||||||||
| Expect(err).ToNot(HaveOccurred()) | ||||||||||||
|
|
||||||||||||
| workerRTNodes, err = nodes.MatchingOptionalSelector(workerRTNodes) | ||||||||||||
| Expect(err).ToNot(HaveOccurred()) | ||||||||||||
| Expect(workerRTNodes).ToNot(BeEmpty()) | ||||||||||||
|
|
||||||||||||
| isArm, err := infrastructure.IsARM(ctx, &workerRTNodes[0]) | ||||||||||||
| Expect(err).ToNot(HaveOccurred()) | ||||||||||||
| if !isArm { | ||||||||||||
| Skip("This test requires an aarch64 arm CPU") | ||||||||||||
| } | ||||||||||||
| }) | ||||||||||||
|
|
||||||||||||
| // Regression test for OCPBUGS-58402 | ||||||||||||
| It("should not add iommu.passthrough to the kernel cmdline", func() { | ||||||||||||
| cmdline, err := nodes.ExecCommand(ctx, &workerRTNodes[0], []string{"cat", "/proc/cmdline"}) | ||||||||||||
| Expect(err).ToNot(HaveOccurred()) | ||||||||||||
| Expect(string(cmdline)).NotTo(ContainSubstring("iommu.passthrough")) | ||||||||||||
| }) | ||||||||||||
|
Comment on lines
+44
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Check node validation patterns in other e2e tests
# Search for patterns where tests iterate over all nodes vs just first node
rg -n 'workerRTNodes\[0\]' test/e2e/performanceprofile/functests/ -B 2 -A 2
rg -n 'for.*range.*workerRTNodes' test/e2e/performanceprofile/functests/ -B 2 -A 2Repository: openshift/cluster-node-tuning-operator Length of output: 50394 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo_root="$(pwd)"
# Show relevant sections for ARM fun tests that use workerRTNodes[0]
for f in \
test/e2e/performanceprofile/functests/14_arm/iommu.go \
test/e2e/performanceprofile/functests/14_arm/kernelpagesize.go \
test/e2e/performanceprofile/functests/14_arm/hugepages.go; do
echo "===== $f (head 120) ====="
nl -ba "$f" | sed -n '1,140p'
done
echo "===== workerRTNodes usage in 14_arm (match lines) ====="
rg -n 'workerRTNodes\[0\]' test/e2e/performanceprofile/functests/14_arm -n
echo "===== loops over workerRTNodes in 14_arm ====="
rg -n 'for .*range.*workerRTNodes|range .*workerRTNodes' test/e2e/performanceprofile/functests/14_arm -n
echo "===== tests with assertion messages patterns in 14_arm ====="
rg -n 'ToNot\(HaveOccurred\(\).*,"|To\(HaveOccurred\(\).*,"|ToNot\(ContainSubstring\([^)]*\).*,"|ContainSubstring\([^)]*\).*,"' test/e2e/performanceprofile/functests/14_arm -n || trueRepository: openshift/cluster-node-tuning-operator Length of output: 221 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show relevant sections for ARM fun tests that use workerRTNodes[0]
for f in \
test/e2e/performanceprofile/functests/14_arm/iommu.go \
test/e2e/performanceprofile/functests/14_arm/kernelpagesize.go \
test/e2e/performanceprofile/functests/14_arm/hugepages.go; do
echo "===== $f (show first 160 lines) ====="
cat -n "$f" | sed -n '1,160p'
done
echo "===== workerRTNodes usage in 14_arm (match lines) ====="
rg -n 'workerRTNodes\[0\]' test/e2e/performanceprofile/functests/14_arm -n
echo "===== loops over workerRTNodes in 14_arm ====="
rg -n 'for .*range.*workerRTNodes|range .*workerRTNodes' test/e2e/performanceprofile/functests/14_arm -n
echo "===== assertion messages patterns in 14_arm ====="
rg -n 'ToNot\(HaveOccurred\(\).*,"|To\(HaveOccurred\(\).*,"|ToNot\(ContainSubstring\([^)]*\).*,"|ContainSubstring\([^)]*\).*,"' test/e2e/performanceprofile/functests/14_arm -n || trueRepository: openshift/cluster-node-tuning-operator Length of output: 18091 Improve failure diagnostics for
diff cmdline, err := nodes.ExecCommand(ctx, &workerRTNodes[0], []string{"cat", "/proc/cmdline"})
- Expect(err).ToNot(HaveOccurred())
- Expect(string(cmdline)).NotTo(ContainSubstring("iommu.passthrough"))
+ Expect(err).ToNot(HaveOccurred(), "failed to read /proc/cmdline from ARM worker node")
+ Expect(string(cmdline)).NotTo(ContainSubstring("iommu.passthrough"), "iommu.passthrough should not be present in /proc/cmdline")🤖 Prompt for AI Agents |
||||||||||||
| }) | ||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/cluster-node-tuning-operator
Length of output: 1030
Remove/resolve the TODOs in
test/e2e/performanceprofile/functests/14_arm/iommu.golabel.OpenShiftcan be removed sinceiommu.goalready includeslabel.OpenShiftin itsDescribe(... Label(...))block (unlike the other TODO).label.SpecializedHardwareshould be resolved by either addinglabel.SpecializedHardwaretoiommu.go’sLabel(...)to match the established14_armpattern (used inkernelpagesize.goandhugepages.go), or replacing the TODO with a concrete rationale/issue reference.🤖 Prompt for AI Agents