Skip to content

Fix the system compressible test case to use drop-in files#31332

Draft
ngopalak-redhat wants to merge 1 commit into
openshift:mainfrom
ngopalak-redhat:ngopalak/compressible_test
Draft

Fix the system compressible test case to use drop-in files#31332
ngopalak-redhat wants to merge 1 commit into
openshift:mainfrom
ngopalak-redhat:ngopalak/compressible_test

Conversation

@ngopalak-redhat

@ngopalak-redhat ngopalak-redhat commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Tests
    • Updated system compressible behavior validation to use current configuration methods.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Walkthrough

The test changes how it obtains the CPU reservation value for system compressible validation. Instead of reading SYSTEM_RESERVED_CPU from /etc/node-sizing.env via string scanning and strconv.ParseFloat, it reads /etc/openshift/kubelet.conf.d/20-auto-sizing.conf, unmarshals it into a KubeletConfiguration, extracts systemReserved["cpu"], and converts the parsed resource quantity from milliCPU to cores.

Changes

System Compressible Test — CPU Reservation Source

Layer / File(s) Summary
CPU reservation parsing via kubelet config
test/extended/node/system_compressible.go
Adds k8s.io/apimachinery/pkg/api/resource and sigs.k8s.io/yaml imports; replaces env-file string scanning with reading 20-auto-sizing.conf, YAML-unmarshalling into KubeletConfiguration, extracting systemReserved["cpu"], and converting milliCPU to float cores with an assertion that the value is greater than zero.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Test has quality issues: Line 35 lacks assertion message, lines 130/323 lack Eventually timeout messages, and line 71 uses panic-prone MustParse without error handling. Add message to line 35 Expect; add messages to lines 130/323 Eventually calls; replace MustParse with ParseQuantity and explicit error handling at line 71.
Single Node Openshift (Sno) Test Compatibility ⚠️ Warning Three new Ginkgo e2e tests added to test/extended/node/system_compressible.go lack SNO protection. Tests use selectTestNode() requiring >=4 CPU worker nodes and lack [Skipped:SingleReplicaTopology]... Add [Skipped:SingleReplicaTopology] label to test names or guard tests with exutil.IsSingleNode() check that skips on SNO deployments to ensure compatibility with Single Node OpenShift clusters.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: updating the system compressible test to use drop-in files instead of the previous approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All test titles (It, Describe) use static strings without dynamic values. Node names are used only in g.By() step annotations within test bodies, not in test titles.
Microshift Test Compatibility ✅ Passed New test suite includes BeforeEach hook with exutil.IsMicroShiftCluster() check that skips all tests on MicroShift, protecting against unavailable MachineConfig APIs.
Topology-Aware Scheduling Compatibility ✅ Passed Change is in test code (test/extended/node/system_compressible.go), not deployment manifests, operator code, or controllers. No topology-aware scheduling check needed.
Ote Binary Stdout Contract ✅ Passed File contains only test code within Ginkgo blocks with no process-level stdout writes; uses framework.Logf and g.By for safe logging, no klog/fmt.Print/os.Stdout calls.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new Ginkgo e2e tests in test/extended/node/system_compressible.go contain no IPv4 assumptions, hardcoded IP addresses, or external connectivity requirements. Tests only read local system config...
No-Weak-Crypto ✅ Passed The PR modifies a test file (test/extended/node/system_compressible.go) to use drop-in configuration files. The changes contain no weak cryptographic algorithms, custom crypto implementations, or n...
Container-Privileges ✅ Passed The PR only modifies a test file (system_compressible.go) containing Go test logic with no Kubernetes container manifests or privileged container configurations present.
No-Sensitive-Data-In-Logs ✅ Passed File logs systemReserved CPU configuration from /etc/openshift/kubelet.conf.d/20-auto-sizing.conf; this contains only non-sensitive resource quantities (cpu, memory), not passwords, tokens, API key...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@ngopalak-redhat

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-disruptive-longrunning

@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@ngopalak-redhat: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-disruptive-longrunning

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/006a3fe0-6f86-11f1-8dce-6e93fa2429c9-0

@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ngopalak-redhat
Once this PR has been reviewed and has the lgtm label, please assign mrunalp for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@test/extended/node/system_compressible.go`:
- Around line 71-73: The `resource.MustParse(cpuQuantity)` call on line 71 will
panic if the configuration value is malformed, causing the test to abort without
a clear error message. Replace `resource.MustParse(cpuQuantity)` with
`resource.ParseQuantity(cpuQuantity)` and add explicit error handling to check
if parsing fails, then use `o.Expect()` or a similar test assertion to fail
gracefully with a descriptive error message explaining that the CPU quantity
could not be parsed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 1d1b3519-963a-4320-9a09-a1e447c4af92

📥 Commits

Reviewing files that changed from the base of the PR and between a2cb43f and 6f70998.

📒 Files selected for processing (1)
  • test/extended/node/system_compressible.go

Comment on lines +71 to +73
cpuResource := resource.MustParse(cpuQuantity)
systemReservedCPU := float64(cpuResource.MilliValue()) / 1000.0
o.Expect(systemReservedCPU).To(o.BeNumerically(">", 0), "systemReserved.cpu should be greater than 0")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the file and the specific lines in question
cat -n test/extended/node/system_compressible.go | sed -n '60,85p'

Repository: openshift/origin

Length of output: 2035


🏁 Script executed:

# Let's also check a broader context to understand where cpuQuantity comes from
cat -n test/extended/node/system_compressible.go | sed -n '1,100p'

Repository: openshift/origin

Length of output: 5316


🏁 Script executed:

# Let's search for other uses of MustParse in this test file to see if there's a pattern
rg "MustParse|ParseQuantity" test/extended/node/system_compressible.go -n

Repository: openshift/origin

Length of output: 206


Avoid panic-prone parsing for node config values.

Line 71 uses resource.MustParse(cpuQuantity), which panics on malformed config and aborts the test. Even though this value comes from a system-controlled configuration file, defensive parsing ensures test stability and provides clear error messages. Use resource.ParseQuantity() with explicit error handling.

Suggested fix
-		cpuResource := resource.MustParse(cpuQuantity)
+		cpuResource, err := resource.ParseQuantity(cpuQuantity)
+		o.Expect(err).NotTo(o.HaveOccurred(), "systemReserved.cpu must be a valid resource quantity")
 		systemReservedCPU := float64(cpuResource.MilliValue()) / 1000.0
📝 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
cpuResource := resource.MustParse(cpuQuantity)
systemReservedCPU := float64(cpuResource.MilliValue()) / 1000.0
o.Expect(systemReservedCPU).To(o.BeNumerically(">", 0), "systemReserved.cpu should be greater than 0")
cpuResource, err := resource.ParseQuantity(cpuQuantity)
o.Expect(err).NotTo(o.HaveOccurred(), "systemReserved.cpu must be a valid resource quantity")
systemReservedCPU := float64(cpuResource.MilliValue()) / 1000.0
o.Expect(systemReservedCPU).To(o.BeNumerically(">", 0), "systemReserved.cpu should be greater than 0")
🤖 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/node/system_compressible.go` around lines 71 - 73, The
`resource.MustParse(cpuQuantity)` call on line 71 will panic if the
configuration value is malformed, causing the test to abort without a clear
error message. Replace `resource.MustParse(cpuQuantity)` with
`resource.ParseQuantity(cpuQuantity)` and add explicit error handling to check
if parsing fails, then use `o.Expect()` or a similar test assertion to fail
gracefully with a descriptive error message explaining that the CPU quantity
could not be parsed.

@ngopalak-redhat

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-disruptive-longrunning

@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@ngopalak-redhat: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-disruptive-longrunning

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/59b0d0c0-6fc0-11f1-89f1-1bdda8b83aee-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant