Skip to content

OCPBUGS-98915: E2E: LLC: Pass fresh ctx variable to DeferCleanup functions#1562

Open
mrniranjan wants to merge 1 commit into
openshift:mainfrom
mrniranjan:llc_context
Open

OCPBUGS-98915: E2E: LLC: Pass fresh ctx variable to DeferCleanup functions#1562
mrniranjan wants to merge 1 commit into
openshift:mainfrom
mrniranjan:llc_context

Conversation

@mrniranjan

@mrniranjan mrniranjan commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Earlier DeferCleanup closure carried ctx from BeforeAll and ginkgo cancels that context after BeforeAll node completes so by the time DeferCleanup runs, the context is already cancelled

Also replace defer with ginkgo's DeferCleanup and pass new context variable

Remove all explicit ctx variables and incorporate them in relevant ginkgo specs like It, BeforeAll etc

Summary by CodeRabbit

  • Tests
    • Improved end-to-end test reliability by propagating execution context consistently across setup, validation, and cleanup steps.
    • Updated cleanup handling to use dedicated cleanup contexts, helping ensure resources are removed correctly after tests.
    • Existing performance profile, CPU alignment, kubelet configuration, and pod validation coverage remains unchanged.

@mrniranjan mrniranjan changed the title Pass fresh ctx variable to DeferCleanup functions E2E: LLC Pass fresh ctx variable to DeferCleanup functions Jul 15, 2026
Earlier DeferCleanup closure carried ctx from BeforeAll
and ginkgo cancels that context after BeforeAll node completes
so by the time DeferCleanup runs, the context is already cancelled

Also replace defer with ginkgo's DeferCleanup and pass new context
variable

Remove all explicit ctx variables and incorporate them in relevant ginkgo
specs like It, BeforeAll etc

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

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Walkthrough

The LLC end-to-end tests now propagate Ginkgo-provided contexts through hooks and test callbacks. Deferred namespace, deployment, and pod cleanup uses cleanup-specific contexts across SMT-enabled, SMT-disabled, multiple-pod, multiple-container, and runtime suites.

Changes

LLC test context modernization

Layer / File(s) Summary
Base LLC and SMT-enabled cleanup
test/e2e/performanceprofile/functests/13_llc/llc.go
LLC setup and SMT-enabled tests use hook-provided contexts, while namespace and deployment cleanup uses DeferCleanup cleanup contexts.
Multiple pod and container flows
test/e2e/performanceprofile/functests/13_llc/llc.go
Multiple-pod and multiple-container tests receive execution contexts and apply them to resource cleanup operations.
Odd CPU request tests
test/e2e/performanceprofile/functests/13_llc/llc.go
SMT-enabled odd-request hooks use supplied contexts, and deployment cleanup is migrated to context-aware DeferCleanup callbacks.
SMT-disabled and runtime cleanup
test/e2e/performanceprofile/functests/13_llc/llc.go
SMT-disabled and runtime tests propagate hook contexts and use cleanup-specific contexts for namespace, deployment, and pod deletion.

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

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Namespace cleanup still uses namespaces.WaitForDeletion without cleanupCtx, and the helper hardcodes context.TODO(), so cleanup can ignore Ginkgo cancellation. Change namespaces.WaitForDeletion to accept a context and pass cleanupCtx from all three DeferCleanup sites.
✅ Passed checks (14 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 All Ginkgo titles in the touched file are static literals; none include pod/node/namespace/IP/timestamp/UUID or computed values.
Microshift Test Compatibility ✅ Passed No new Ginkgo specs were added; the patch only changes context/cleanup plumbing in an existing LLC e2e suite.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The LLC tests select one node and use pod/deployment CPU alignment; they don’t use multi-node scheduling, failover, or anti-affinity.
Topology-Aware Scheduling Compatibility ✅ Passed Only an e2e test file changed, and the diff is limited to context/cleanup propagation; no scheduling constraints or topology assumptions were added.
Ote Binary Stdout Contract ✅ Passed llc.go has no stdout write calls or init/main hooks; test_suite_llc_test.go sends logs to stderr and only calls RunSpecs.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR only threads context/cleanup changes; it adds no IPv4 literals, URL construction, or new external connectivity requirements.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons appear in the changed test file.
Container-Privileges ✅ Passed Only modified file is a Go test; searches found no privileged/hostPID/hostNetwork/hostIPC/allowPrivilegeEscalation/SYS_ADMIN/root settings.
No-Sensitive-Data-In-Logs ✅ Passed The patch only adds pod-deletion cleanup logs; no changed log statements expose secrets, tokens, PII, hostnames, or customer data.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: using a fresh context for LLC test DeferCleanup cleanup functions.
✨ 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.

@mrniranjan mrniranjan changed the title E2E: LLC Pass fresh ctx variable to DeferCleanup functions E2E: LLC: Pass fresh ctx variable to DeferCleanup functions Jul 15, 2026
@openshift-ci
openshift-ci Bot requested review from swatisehgal and yanirq July 15, 2026 16:21

@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/e2e/performanceprofile/functests/13_llc/llc.go`:
- Around line 337-340: Update namespaces.WaitForDeletion to accept a
context.Context and use it for the polling loop instead of context.TODO(),
following the pods.WaitForDeletion pattern. In
test/e2e/performanceprofile/functests/13_llc/llc.go at lines 337-340, 1145-1148,
and 1224-1227, pass cleanupCtx to every namespaces.WaitForDeletion call so
cleanup cancellation propagates through namespace deletion waits.
🪄 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: 5d0d5370-737a-4625-b705-7e249e51957c

📥 Commits

Reviewing files that changed from the base of the PR and between 19b0d74 and 904ad92.

📒 Files selected for processing (1)
  • test/e2e/performanceprofile/functests/13_llc/llc.go

Comment thread test/e2e/performanceprofile/functests/13_llc/llc.go
@mrniranjan

Copy link
Copy Markdown
Contributor Author

/retest-required

@ffromani ffromani 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.

/approve
/lgtm

thanks

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

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ffromani, 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 16, 2026
@mrniranjan mrniranjan changed the title E2E: LLC: Pass fresh ctx variable to DeferCleanup functions OCPBUGS-98915: E2E: LLC: Pass fresh ctx variable to DeferCleanup functions Jul 16, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. 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 16, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@mrniranjan: This pull request references Jira Issue OCPBUGS-98915, 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:

Earlier DeferCleanup closure carried ctx from BeforeAll and ginkgo cancels that context after BeforeAll node completes so by the time DeferCleanup runs, the context is already cancelled

Also replace defer with ginkgo's DeferCleanup and pass new context variable

Remove all explicit ctx variables and incorporate them in relevant ginkgo specs like It, BeforeAll etc

Summary by CodeRabbit

  • Tests
  • Improved end-to-end test reliability by propagating execution context consistently across setup, validation, and cleanup steps.
  • Updated cleanup handling to use dedicated cleanup contexts, helping ensure resources are removed correctly after tests.
  • Existing performance profile, CPU alignment, kubelet configuration, and pod validation coverage remains unchanged.

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 16, 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-ci

openshift-ci Bot commented Jul 16, 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.

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/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. 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.

3 participants