Skip to content

OCPBUGS-98399: E2E: Add functional test cases checking GOMAXPROCS#1556

Merged
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
mrniranjan:gomaxprocs_e2e_test
Jul 10, 2026
Merged

OCPBUGS-98399: E2E: Add functional test cases checking GOMAXPROCS#1556
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
mrniranjan:gomaxprocs_e2e_test

Conversation

@mrniranjan

@mrniranjan mrniranjan commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

E2E: Add functional test cases checking GOMAXPROCS

Following tests were added:

  1. Verify GOMAXPROCS configuration is injected when Performance Profile is applied
  2. Create a go-based container with below scenarios
    BestEffort - No Requests/Limits
    Burstable low - cpu:100m requests, no limits
    Burstable high - cpu:8 requests, no limits (2x overcommit)
    Guaranteed - cpu:1 request + limit
    Guaranteed with runtime class - cpu:1 request + limit
    Init + app container - cpu:100m on both, no limits
    Burstable with limit - cpu:2 request, cpu:4 limit

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests
    • Expanded end-to-end coverage for performance profile behavior, including GOMAXPROCS handling across multiple pod CPU request/limit configurations, runtime class scenarios, and init container behavior.
    • Added assertions for node-level runtime configuration to ensure the expected minimum injected GOMAXPROCS is present.
    • Improved reliability by adding stronger checks for when GOMAXPROCS should be absent, and ensuring created pods are cleaned up even on failures.

@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 Jul 2, 2026
@mrniranjan mrniranjan marked this pull request as draft July 2, 2026 12:16
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Walkthrough

The PR adds e2e coverage for GOMAXPROCS behavior on performance-profile nodes. It verifies CRI-O configuration on workers and checks pod-visible GOMAXPROCS outcomes across multiple QoS, runtime-class, and init-container cases.

Changes

GOMAXPROCS configuration coverage

Layer / File(s) Summary
CRI-O config check
test/e2e/performanceprofile/functests/1_performance/performance.go
Reads each worker node’s CRI-O runtimes config from /rootfs and asserts crio.runtime.min_injected_gomaxprocs is 4.
Pod creation and readiness
test/e2e/performanceprofile/functests/1_performance/performance.go
Builds and creates a debug-tools pod on a worker node, with optional runtime class, CPU/memory requests and limits, and optional init container, then waits for readiness with cleanup.
Pod GOMAXPROCS assertions
test/e2e/performanceprofile/functests/1_performance/performance.go
Validates either absence of injected GOMAXPROCS or knit goprocs output for the ready pod across the table-driven scenarios.

Estimated code review effort: 3 (Moderate) | ~20 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error New logs print node.Name in GOMAXPROCS checks, which may expose internal hostnames. Redact or omit node names in test logs; use generic labels or hashed IDs instead.
Test Structure And Quality ⚠️ Warning The new GOMAXPROCS tests still contain several bare assertions, including pod create/exec checks and the CRIO value equality check, so failures are hard to diagnose. Add descriptive failure messages to the bare expectations in the new block (create, exec, config value checks), or split steps with By(...) for clearer diagnostics.
Microshift Test Compatibility ⚠️ Warning The new GOMAXPROCS e2e cases use performance.openshift.io/tuned.openshift.io resources and have no MicroShift skip/tag guard. Add a [Skipped:MicroShift] label or an [apigroup:...] tag, or guard the Context/Its with exutil.IsMicroShiftCluster() and g.Skip().
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning The new GOMAXPROCS test hardcodes quay.io/openshift-kni/debug-tools:latest and uses PullAlways, requiring external registry access. Use a mirrored/internal pullspec (preferably env-configured) or skip the test on disconnected clusters with [Skipped:Disconnected].
✅ Passed checks (11 passed)
Check name Status Explanation
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 The new Ginkgo titles are static strings; I found no timestamps, node/pod/namespace names, UUIDs, or other run-specific data in test names.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new GOMAXPROCS tests only use the first available worker and iterate existing worker nodes; they don’t require >1 node or cross-node behavior.
Topology-Aware Scheduling Compatibility ✅ Passed Only e2e test code changed; it creates ephemeral debug pods and reads node config, with no deployment/controller scheduling constraints added.
Ote Binary Stdout Contract ✅ Passed The PR adds only Ginkgo test bodies; suite-level setup logs to GinkgoWriter/stderr, and no new stdout writes appear in main/init/BeforeSuite/RunSpecs paths.
No-Weak-Crypto ✅ Passed Changed test file only adds GOMAXPROCS/resource/env checks; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or custom crypto logic found.
Container-Privileges ✅ Passed The new e2e pod spec is unprivileged; no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings were added.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding E2E functional coverage for GOMAXPROCS behavior.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from ffromani and yanirq July 2, 2026 12:17
Following tests were added:
1. Verify GOMAXPROCS configuration is injected when Performance Profile
   is applied
2. Create a go-based container with below scenarios
   BestEffort - No Requests/Limits
   Burstable low - cpu:100m requests, no limits
   Burstable high - cpu:8 requests, no limits (2x overcommit)
   Guaranteed - cpu:1 request + limit
   Guaranteed with runtime class - cpu:1 request + limit
   Init + app container - cpu:100m on both, no limits
   Burstable with limit - cpu:2 request, cpu:4 limit

Signed-off-by: Niranjan M.R <mniranja@redhat.com>
@mrniranjan mrniranjan force-pushed the gomaxprocs_e2e_test branch from 961314a to 3dee669 Compare July 6, 2026 11:41
@mrniranjan mrniranjan changed the title WIP: E2E: Add functional test cases checking GOMAXPROCS E2E: Add functional test cases checking GOMAXPROCS Jul 6, 2026
@mrniranjan mrniranjan marked this pull request as ready for review July 6, 2026 11:42
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2026
@openshift-ci openshift-ci Bot requested a review from MarSik July 6, 2026 11:44

@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: 3

🧹 Nitpick comments (1)
test/e2e/performanceprofile/functests/1_performance/performance.go (1)

1238-1242: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Derive the runtime class name instead of hard-coding it.

This file derives performance-profile-owned names elsewhere. Hard-coding "performance-performance" makes this entry fail when the configured performance profile name differs.

Proposed change
 			Entry("Guaranteed with runtime class - cpu:1 request + limit",
 				"Guaranteed-RuntimeClass",
 				ptr.To(resource.MustParse("1")), ptr.To(resource.MustParse("1")),
-				false, ptr.To("performance-performance"),
+				false, ptr.To(components.GetComponentName(testutils.PerformanceProfileName, components.ProfileNamePerformance)),
 				"", true,
 			),
🤖 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/e2e/performanceprofile/functests/1_performance/performance.go` around
lines 1238 - 1242, The runtime class name in this table-driven case is
hard-coded, which breaks when the performance profile name changes. Update the
“Guaranteed-RuntimeClass” entry in performance.go to derive the runtime class
name the same way the other performance-profile-owned names are built in this
file, using the existing helper/derived profile name logic instead of the
literal "performance-performance".
🤖 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/e2e/performanceprofile/functests/1_performance/performance.go`:
- Around line 1168-1172: The cleanup path in DeferCleanup is using an unbounded
context, and the pod exec flow behind pods.ExecCommandOnPod also lacks
cancellation control. Replace the context.Background() cleanupCtx with a fresh
timeout-derived context tied to the spec/test scope, and update or add a
context-aware pod exec helper so exec calls do not rely on context.TODO(). Apply
the same bounded-context pattern to the related cleanup block that deletes the
test pod and any exec paths in the performance test helpers.
- Around line 1124-1127: The “Burstable-High” test setup unconditionally pins
the pod to workerRTNodes[0], which can leave the pod Pending on small clusters
with insufficient CPU. Update the test flow around pods.GetTestPod(),
testpod.Spec.NodeSelector, and runtimeClassName to first verify the selected
node can satisfy the 8-CPU request, and if not, skip or guard this case rather
than waiting for the full timeout. Apply the same protection in the later
duplicated setup around the other Burstable-High block as well.
- Around line 1135-1146: The Guaranteed pod setup in the performance test only
assigns CPU resources, so the pod can still remain Burstable. Update the
container resource setup in the code that configures
testpod.Spec.Containers[0].Resources to also set matching memory request and
limit whenever the Guaranteed path is being exercised, and make the same change
in the runtime-class variant so both paths stay aligned.

---

Nitpick comments:
In `@test/e2e/performanceprofile/functests/1_performance/performance.go`:
- Around line 1238-1242: The runtime class name in this table-driven case is
hard-coded, which breaks when the performance profile name changes. Update the
“Guaranteed-RuntimeClass” entry in performance.go to derive the runtime class
name the same way the other performance-profile-owned names are built in this
file, using the existing helper/derived profile name logic instead of the
literal "performance-performance".
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ea2e2504-5787-4660-968c-1b9b29f4e931

📥 Commits

Reviewing files that changed from the base of the PR and between 961314a and 3dee669.

📒 Files selected for processing (1)
  • test/e2e/performanceprofile/functests/1_performance/performance.go

Comment thread test/e2e/performanceprofile/functests/1_performance/performance.go Outdated
Comment thread test/e2e/performanceprofile/functests/1_performance/performance.go
Comment on lines +1168 to +1172
DeferCleanup(func() {
testlog.Infof("[%s] Cleaning up test pod: %s", testCase, testpod.Name)
cleanupCtx := context.Background()
err := testclient.DataPlaneClient.Delete(cleanupCtx, testpod)
if err != nil {

@coderabbitai coderabbitai Bot Jul 6, 2026

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 | 🏗️ Heavy lift

Keep cleanup and pod exec calls bounded by context timeouts.

Line 1170 uses an unbounded context.Background(), and these new exec paths call pods.ExecCommandOnPod, which uses context.TODO() internally. A stalled API delete or SPDY exec can outlive the spec context. Use a fresh timeout for cleanup and add/use a context-aware pod exec helper. As per path instructions, **/*.go: context.Context for cancellation and timeouts.

Proposed cleanup-side fix
 				DeferCleanup(func() {
 					testlog.Infof("[%s] Cleaning up test pod: %s", testCase, testpod.Name)
-					cleanupCtx := context.Background()
+					cleanupCtx, cancel := context.WithTimeout(context.Background(), time.Minute)
+					defer cancel()
 					err := testclient.DataPlaneClient.Delete(cleanupCtx, testpod)

Also applies to: 1182-1191

🤖 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/e2e/performanceprofile/functests/1_performance/performance.go` around
lines 1168 - 1172, The cleanup path in DeferCleanup is using an unbounded
context, and the pod exec flow behind pods.ExecCommandOnPod also lacks
cancellation control. Replace the context.Background() cleanupCtx with a fresh
timeout-derived context tied to the spec/test scope, and update or add a
context-aware pod exec helper so exec calls do not rely on context.TODO(). Apply
the same bounded-context pattern to the related cleanup block that deletes the
test pod and any exec paths in the performance test helpers.

Source: Path instructions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

check again on the latest commit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Locate candidate helper files =="
fd -i 'pods*.go' test/e2e/performanceprofile/functests/utils || true

echo
echo "== Outline performance.go around GOMAXPROCS additions =="
ast-grep outline test/e2e/performanceprofile/functests/1_performance/performance.go --items all --type function

echo
echo "== Show current GOMAXPROCS block in performance.go =="
sed -n '1095,1235p' test/e2e/performanceprofile/functests/1_performance/performance.go

echo
echo "== Outline pods helper files =="
for f in $(fd -i 'pods*.go' test/e2e/performanceprofile/functests/utils); do
  echo "-- $f --"
  ast-grep outline "$f" --items all --type function || true
done

echo
echo "== Search for ExecCommandOnPod definitions and calls =="
rg -n -C3 '\bExecCommandOnPod\s*\(' test/e2e/performanceprofile/functests

echo
echo "== Read pods helper implementation slices =="
for f in $(fd -i 'pods*.go' test/e2e/performanceprofile/functests/utils); do
  if rg -n '\bExecCommandOnPod\s*\(' "$f" >/dev/null; then
    echo "-- $f --"
    ln=$(rg -n '\bExecCommandOnPod\s*\(' "$f" | cut -d: -f1 | head -n1)
    start=$((ln>25 ? ln-25 : 1))
    end=$((ln+80))
    sed -n "${start},${end}p" "$f"
  fi
done

Length of output: 32036


@mrniranjan, re-checked on the latest commit:

  • DeferCleanup is now properly bounded with context.WithTimeout(...), so that part is fixed.
  • The remaining concern is still valid: the new exec calls at Line 1198 and Line 1206 still go through test/e2e/performanceprofile/functests/utils/pods/pods.go, where ExecCommandOnPod() uses exec.StreamWithContext(context.TODO(), ...).

So I’d consider this partially addressed, but I wouldn’t withdraw the thread yet until the pod exec helper is made context-aware (or a context-aware variant is introduced and used here).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The cleanup path has been fixed to use context.WithTimeout() for the pod deletion. If making the exec helper context-aware is needed, that should be addressed in a separate PR to avoid impacting other tests that depend on this shared utility

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mrniranjan, that's a reasonable call — the DeferCleanup fix addresses the immediate risk in this PR, and changing the shared ExecCommandOnPod() helper's context handling in test/e2e/performanceprofile/functests/utils/pods/pods.go does carry a wider blast radius across other tests that depend on it. Deferring that to a separate, focused PR makes sense.

Would you like me to open a follow-up issue to track making ExecCommandOnPod() context-aware? If so, let me know who should be assigned (defaulting to you if unspecified).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

okay assign it to me

Signed-off-by: Niranjan M.R <mniranja@redhat.com>
Signed-off-by: Niranjan M.R <mniranja@redhat.com>
@mrniranjan

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-pao

@openshift-ci

openshift-ci Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@mrniranjan: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@MarSik MarSik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2026
@openshift-ci

openshift-ci Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MarSik, mrniranjan

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2026
@mrniranjan mrniranjan changed the title E2E: Add functional test cases checking GOMAXPROCS OCPBUGS-98399: E2E: Add functional test cases checking GOMAXPROCS Jul 10, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jul 10, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@mrniranjan: This pull request references Jira Issue OCPBUGS-98399, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

E2E: Add functional test cases checking GOMAXPROCS

Following tests were added:

  1. Verify GOMAXPROCS configuration is injected when Performance Profile is applied
  2. Create a go-based container with below scenarios
    BestEffort - No Requests/Limits
    Burstable low - cpu:100m requests, no limits
    Burstable high - cpu:8 requests, no limits (2x overcommit)
    Guaranteed - cpu:1 request + limit
    Guaranteed with runtime class - cpu:1 request + limit
    Init + app container - cpu:100m on both, no limits
    Burstable with limit - cpu:2 request, cpu:4 limit

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests
  • Expanded end-to-end coverage for performance profile behavior, including GOMAXPROCS handling across multiple pod CPU request/limit configurations, runtime class scenarios, and init container behavior.
  • Added assertions for node-level runtime configuration to ensure the expected minimum injected GOMAXPROCS is present.
  • Improved reliability by adding stronger checks for when GOMAXPROCS should be absent, and ensuring created pods are cleaned up even on failures.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@mrniranjan

Copy link
Copy Markdown
Contributor Author

/verified by @mrniranjan

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 10, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@mrniranjan: This PR has been marked as verified by @mrniranjan.

Details

In response to this:

/verified by @mrniranjan

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot openshift-merge-bot Bot merged commit 35d8129 into openshift:main Jul 10, 2026
20 checks passed
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@mrniranjan: Jira Issue Verification Checks: Jira Issue OCPBUGS-98399
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-98399 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

E2E: Add functional test cases checking GOMAXPROCS

Following tests were added:

  1. Verify GOMAXPROCS configuration is injected when Performance Profile is applied
  2. Create a go-based container with below scenarios
    BestEffort - No Requests/Limits
    Burstable low - cpu:100m requests, no limits
    Burstable high - cpu:8 requests, no limits (2x overcommit)
    Guaranteed - cpu:1 request + limit
    Guaranteed with runtime class - cpu:1 request + limit
    Init + app container - cpu:100m on both, no limits
    Burstable with limit - cpu:2 request, cpu:4 limit

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests
  • Expanded end-to-end coverage for performance profile behavior, including GOMAXPROCS handling across multiple pod CPU request/limit configurations, runtime class scenarios, and init container behavior.
  • Added assertions for node-level runtime configuration to ensure the expected minimum injected GOMAXPROCS is present.
  • Improved reliability by adding stronger checks for when GOMAXPROCS should be absent, and ensuring created pods are cleaned up even on failures.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@mrniranjan

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-4.22

@openshift-cherrypick-robot

Copy link
Copy Markdown

@mrniranjan: new pull request created: #1561

Details

In response to this:

/cherry-pick release-4.22

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants