Skip to content

OLS-3238 - fixing product-e2e crash pod addition - #397

Open
JoaoFula wants to merge 1 commit into
openshift:mainfrom
JoaoFula:fix-product-e2e-tests
Open

OLS-3238 - fixing product-e2e crash pod addition#397
JoaoFula wants to merge 1 commit into
openshift:mainfrom
JoaoFula:fix-product-e2e-tests

Conversation

@JoaoFula

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved end-to-end test execution so successful provider checks no longer prematurely stop the test script.
  • Tests

    • Added validation that test environments can detect and handle a consistently restarting workload.
    • Applied this validation across both simulated and real provider test setups.

Walkthrough

E2E execution now safely aggregates provider exit codes and provisions a verified crash-loop Pod in the staging namespace for both mock and real provider fixtures.

Changes

E2E stability

Layer / File(s) Summary
Provider result aggregation
scripts/e2e-cluster.sh
Guards the overall_rc arithmetic update so a zero result does not terminate the script under set -e.
Crash-loop fixture provisioning
test/e2e/helpers_test.go
Creates and verifies the restarting staging/e2e-crasher Pod, cleans up prior instances, and invokes the helper for mock and real provider fixtures.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided, so the check cannot verify relation to the changeset. Add a short description of the e2e crash-pod fixture and script fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title refers to the crash pod addition, which matches a main part of the changeset.
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.

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 joshuawilson and raptorsun July 29, 2026 13:45
@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign harche 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/e2e/helpers_test.go`:
- Around line 159-174: Update the pod cleanup and recreation flow around
c.Delete, wait.PollUntilContextTimeout, c.Get, and T.Cleanup to propagate
failures instead of ignoring them. Treat only NotFound as an acceptable
delete/get result, fail the test on other API errors or polling timeout errors,
and ensure cleanup deletion errors are not discarded; only proceed to c.Create
after confirming the prior Pod is absent.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e17d2043-71bb-4691-a2ba-a1161323863e

📥 Commits

Reviewing files that changed from the base of the PR and between aa1a965 and 4953c31.

📒 Files selected for processing (2)
  • scripts/e2e-cluster.sh
  • test/e2e/helpers_test.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/lightspeed-agentic-sandbox (manual)

Comment thread test/e2e/helpers_test.go
Comment on lines +159 to +174
_ = c.Delete(ctx, pod)
// Wait briefly for any previous instance to terminate.
_ = wait.PollUntilContextTimeout(ctx, time.Second, 30*time.Second, true, func(ctx context.Context) (bool, error) {
var existing corev1.Pod
if err := c.Get(ctx, types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, &existing); err != nil {
return true, nil
}
return false, nil
})

if err := c.Create(ctx, pod); err != nil && !apierrors.IsAlreadyExists(err) {
t.Fatalf("create crash-loop pod: %v", err)
}
t.Cleanup(func() {
_ = c.Delete(context.Background(), pod)
})

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 | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file and relevant symbols =="
git ls-files | grep -E '(^|/)helpers_test\.go$|go\.mod$' || true
rg -n "ensureCrashLoopPod|staging/e2e-crasher|wait\.PollUntilContextTimeout|Delete\\(ctx, pod\\)|c\\.Delete\\(context\\.Background\\(\\), pod\\)" test/e2e/helpers_test.go || true

echo "== relevant helper section =="
sed -n '130,190p' test/e2e/helpers_test.go
echo "== call sites =="
rg -n "ensureCrashLoopPod\\(" test/e2e/helpers_test.go -C 5 || true

echo "== go.mod versions =="
rg -n "k8s\\.io/apimachinery|sigs\\.k8s\\.io/controller-runtime" go.mod test/e2e/go.mod 2>/dev/null || true
sed -n '1,160p' go.mod

Repository: openshift/lightspeed-agentic-operator

Length of output: 9886


Handle delete and polling failures before accepting an existing Pod.

c.Delete(ctx, pod)/Get(ctx, …) failures and PollUntilContextTimeout errors are currently swallowed, then the path can fall through to creating an existing Pod. This masks fixture cleanup failures and can reuse a stale staging/e2e-crasher Pod. Fail on non-NotFound delete/get/poll errors and stop discarding Delete/T.Cleanup errors.

🤖 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/helpers_test.go` around lines 159 - 174, Update the pod cleanup and
recreation flow around c.Delete, wait.PollUntilContextTimeout, c.Get, and
T.Cleanup to propagate failures instead of ignoring them. Treat only NotFound as
an acceptable delete/get result, fail the test on other API errors or polling
timeout errors, and ensure cleanup deletion errors are not discarded; only
proceed to c.Create after confirming the prior Pod is absent.

Source: Path instructions

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant