Skip to content

Add 6 standalone FAR destructive tests and improve test resiliency - #49

Merged
openshift-merge-bot[bot] merged 4 commits into
medik8s:mainfrom
ugreener:feat/far-standalone-tests
Jul 16, 2026
Merged

Add 6 standalone FAR destructive tests and improve test resiliency#49
openshift-merge-bot[bot] merged 4 commits into
medik8s:mainfrom
ugreener:feat/far-standalone-tests

Conversation

@ugreener

@ugreener ugreener commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Add 6 standalone FAR destructive remediation tests and improve overall FAR test resiliency.

Tracking: RHWA-963

New destructive tests (ported from ocp-edge-auto to Go/Ginkgo):

  • Remediate a worker node via standalone FAR CR (OCP-61229)
  • Remediate the node hosting the active FAR controller (OCP-70638)
  • Apply FAR NoSchedule taint during remediation (OCP-65960)
  • Report correct FAR CR status conditions after remediation (OCP-67015)
  • Default to reboot action when --action is omitted (OCP-66203)
  • Transfer controller leadership when active pod is deleted (OCP-70636)

Test structure (nested Context/BeforeEach pattern per Ginkgo best practices):

  • "non-leader worker target" Context with shared BeforeEach for node selection, boot ID recording, workload pod creation, and shared JustAfterEach for workload eviction verification
  • "leader node target" Context for OCP-70638 (targets the active controller node)
  • "Controller lifecycle" Context for OCP-70636 (non-destructive pod deletion test)

Resiliency improvements:

  • Randomize SelectWorkerNode to prevent deterministic reuse of the same node across sequential destructive tests
  • Add post-remediation CRI-O overlay storage cleanup (rm -rf /var/lib/containers/storage/overlay/l && systemctl restart crio) to prevent overlay corruption from cascading across tests
  • Add logPodDiagnostics function that logs pod Events, container statuses (Waiting/Terminated reasons), and pod conditions on workload pod failure
  • Add createFARCR helper with retry via Eventually to handle transient webhook timeouts
  • Add waitForRemediation helper encapsulating WaitForNodeReboot + WaitForNodeReady sequence
  • Add controller readiness pre-flight check in BeforeEach before each destructive test
  • Add logFARControllerState diagnostic logging on test failure
  • Wrap workload pod creation in Eventually for resilience after node reboots in ContinueOnFailure suites
  • Fix racy "pod is running" smoke test (OCP-66026): replace two-step wait+count pattern with Eventually loop

@openshift-ci
openshift-ci Bot requested review from lyfofvipin and swgoswam July 2, 2026 13:57
@openshift-ci openshift-ci Bot added the approved label Jul 2, 2026
@qodo-2-for-medik8s

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again

Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds FAR destructive remediation test coverage, supporting constants and helpers, a node debug namespace fix, controller failover checks, and README documentation for the destructive scenarios.

Changes

FAR Destructive Remediation Tests

Layer / File(s) Summary
FAR condition and timing constants
tests/far-operator/internal/farparams/const.go
Adds FAR remediation condition strings, a NoSchedule taint key, and retry and timeout constants used by the destructive tests.
Test setup and CR helper
tests/far-operator/tests/far_destructive.go, tests/internal/helpers/node_ops.go
Updates imports and scaffolding, refreshes leader lookup before each test, updates node debug execution, and adds the unstructured FAR CR builder helper.
Standalone remediation scenarios
tests/far-operator/tests/far_destructive.go
Adds tests for worker remediation, controller-node remediation with failover, taint verification, status condition checks, default action behavior, and workload pod eviction or deletion.
Controller leadership handover
tests/far-operator/tests/far_destructive.go
Adds a test that deletes the active FAR controller pod, waits for readiness, and verifies leadership moves to another running pod.
Destructive tests documentation
tests/far-operator/README.md
Adds a README section with prerequisites and destructive test cases 10–16.

Estimated code review effort: 4 (Complex) | ~50 minutes

Possibly related PRs

Suggested reviewers: maximunited, lyfofvipin, swgoswam

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the PR’s main focus on standalone FAR destructive tests and resiliency improvements, even though the test count is slightly off.
✨ 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.

@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

🤖 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 `@tests/far-operator/README.md`:
- Around line 118-120: The Destructive Tests section in README groups
`OCP-70636` with node-fencing, but that test is a controller-pod handover case
and needs its own subsection. Update the documentation around the `OCP-70636`
entry to separate it from the `fence_aws`/node-reboot description, and adjust
the prerequisites and command guidance so they match the actual `OCP-70636`
implementation and `disruption:destructive` tagging.

In `@tests/far-operator/tests/far_destructive.go`:
- Around line 490-499: The `Eventually` in the workload pod phase check uses a
hardcoded `2*time.Minute` instead of a shared timeout constant. Add a named
timeout in `farparams` (for example, a `PodRunningTimeout` constant in
`farparams/const.go`) and update the `Eventually` call in the pod-running
assertion to use that constant with the existing
`farparams.DefaultPollInterval`, matching the other timeout usages in
`far_destructive.go`.
- Around line 527-530: The leadership-transfer spec is tagged with both
disruption modes, which causes it to match conflicting filters. Update the test
case in the controller leadership scenario so it only keeps the inherited
destructive classification and remove the extra labels.DisruptionNonDestructive
label from the It block.
🪄 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

Run ID: bfcfbf47-45ef-4f4c-a835-ffc51b0e7621

📥 Commits

Reviewing files that changed from the base of the PR and between 7e6d04c and 287d9ab.

📒 Files selected for processing (3)
  • tests/far-operator/README.md
  • tests/far-operator/internal/farparams/const.go
  • tests/far-operator/tests/far_destructive.go

Comment thread tests/far-operator/README.md
Comment thread tests/far-operator/tests/far_destructive.go Outdated
Comment thread tests/far-operator/tests/far_destructive.go Outdated
@ugreener ugreener changed the title far-operator: add standalone FAR remediation tests Draft: far-operator: add standalone FAR remediation tests Jul 2, 2026
@ugreener ugreener changed the title Draft: far-operator: add standalone FAR remediation tests Draft: Add 7 standalone FAR destructive remediation tests Jul 2, 2026
@ugreener
ugreener force-pushed the feat/far-standalone-tests branch 3 times, most recently from 2409733 to 6a592d5 Compare July 2, 2026 14:58
@ugreener

ugreener commented Jul 2, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@ugreener
ugreener force-pushed the feat/far-standalone-tests branch from 6a592d5 to 44f4635 Compare July 2, 2026 18:03
@ugreener

ugreener commented Jul 2, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@ugreener
ugreener force-pushed the feat/far-standalone-tests branch from 44f4635 to 2169be9 Compare July 3, 2026 09:34
@ugreener

ugreener commented Jul 3, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

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

🧹 Nitpick comments (2)
tests/far-operator/tests/far_destructive.go (2)

654-677: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

buildFARUnstructured duplicates buildFARTUnstructured's spec-construction logic.

Both helpers build near-identical spec maps (agent/sharedparameters/nodeparameters/retrycount/retryinterval/timeout/remediationStrategy), differing only in whether it's nested under template.spec. Consider extracting a shared buildFARSpec(...) helper to avoid drift between the two builders as fields evolve.

♻️ Proposed refactor
+func buildFARSpec(agent string, sharedParams, nodeParams map[string]interface{}) map[string]interface{} {
+	return map[string]interface{}{
+		"agent":               agent,
+		"sharedparameters":    sharedParams,
+		"nodeparameters":      nodeParams,
+		"retrycount":          farparams.FARCRRetryCount,
+		"retryinterval":       farparams.FARCRRetryInterval,
+		"timeout":             farparams.FARCRTimeout,
+		"remediationStrategy": farparams.FARCRRemediationStrategy,
+	}
+}
+
 func buildFARUnstructured(
 	nodeName, agent string,
 	sharedParams, nodeParams map[string]interface{},
 ) *unstructured.Unstructured {
 	return &unstructured.Unstructured{
 		Object: map[string]interface{}{
 			"apiVersion": "fence-agents-remediation.medik8s.io/v1alpha1",
 			"kind":       "FenceAgentsRemediation",
 			"metadata": map[string]interface{}{
 				"name":      nodeName,
 				"namespace": medik8sparams.OperatorNs,
 			},
-			"spec": map[string]interface{}{
-				"agent":               agent,
-				"sharedparameters":    sharedParams,
-				"nodeparameters":      nodeParams,
-				"retrycount":          farparams.FARCRRetryCount,
-				"retryinterval":       farparams.FARCRRetryInterval,
-				"timeout":             farparams.FARCRTimeout,
-				"remediationStrategy": farparams.FARCRRemediationStrategy,
-			},
+			"spec": buildFARSpec(agent, sharedParams, nodeParams),
 		},
 	}
 }
🤖 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 `@tests/far-operator/tests/far_destructive.go` around lines 654 - 677,
`buildFARUnstructured` is duplicating the same FAR `spec` construction already
used by `buildFARTUnstructured`, which risks the two builders drifting apart.
Extract the shared fields (`agent`, `sharedparameters`, `nodeparameters`,
`retrycount`, `retryinterval`, `timeout`, `remediationStrategy`) into a common
helper such as `buildFARSpec(...)`, and have both builders reuse it with their
respective wrapping (`spec` vs `template.spec`). Keep the existing
`buildFARUnstructured` and `buildFARTUnstructured` entry points, but centralize
the shared map assembly so future field changes only happen in one place.

617-623: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant nil check after already-asserted expectation.

assertion.Expect(lease.Spec.HolderIdentity).ToNot(BeNil()) already fails the poll iteration if nil; the follow-up if lease.Spec.HolderIdentity != nil guard is unreachable dead code at that point.

🤖 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 `@tests/far-operator/tests/far_destructive.go` around lines 617 - 623, The nil
guard around lease.Spec.HolderIdentity is redundant because the preceding
Expect(...).ToNot(BeNil()) already handles the nil case in the polling
assertion. In the test flow that checks lease ownership after pod deletion,
remove the extra if block and keep the direct dereference/assertion path in the
same check so the logic stays clean and only relies on the existing expectation
around lease.Spec.HolderIdentity and oldPodName.
🤖 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 `@tests/far-operator/tests/far_destructive.go`:
- Around line 596-608: Remove the nested wait around the FAR deployment
readiness check in the test flow using deployment.Pull and IsReady. The current
Eventually wrapper is redundant because IsReady already blocks internally, so
replace it with a direct readiness assertion or switch to a non-blocking check
before retrying. Keep the logic near the FAR controller deployment readiness
validation, and preserve the existing timeout intent without stacking two
waiting mechanisms.
- Around line 171-183: The safety-net recovery path in JustAfterEach only logs
when farutils.WaitForNodeReady fails, which lets later Ordered specs continue
while the cluster is still degraded. Update the recovery branch to fail the spec
when the remediated node does not become Ready, using the existing nodeName,
farparams.NodeReadyTimeout, and AddReportEntry context in far_destructive.go.
Keep the warning/reporting, but also surface the error through the test failure
path so ContinueOnFailure does not mask the original issue.

---

Nitpick comments:
In `@tests/far-operator/tests/far_destructive.go`:
- Around line 654-677: `buildFARUnstructured` is duplicating the same FAR `spec`
construction already used by `buildFARTUnstructured`, which risks the two
builders drifting apart. Extract the shared fields (`agent`, `sharedparameters`,
`nodeparameters`, `retrycount`, `retryinterval`, `timeout`,
`remediationStrategy`) into a common helper such as `buildFARSpec(...)`, and
have both builders reuse it with their respective wrapping (`spec` vs
`template.spec`). Keep the existing `buildFARUnstructured` and
`buildFARTUnstructured` entry points, but centralize the shared map assembly so
future field changes only happen in one place.
- Around line 617-623: The nil guard around lease.Spec.HolderIdentity is
redundant because the preceding Expect(...).ToNot(BeNil()) already handles the
nil case in the polling assertion. In the test flow that checks lease ownership
after pod deletion, remove the extra if block and keep the direct
dereference/assertion path in the same check so the logic stays clean and only
relies on the existing expectation around lease.Spec.HolderIdentity and
oldPodName.
🪄 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

Run ID: 2626221b-8263-493d-8b72-06480656bcf6

📥 Commits

Reviewing files that changed from the base of the PR and between 44f4635 and 2169be9.

📒 Files selected for processing (4)
  • tests/far-operator/README.md
  • tests/far-operator/internal/farparams/const.go
  • tests/far-operator/tests/far_destructive.go
  • tests/internal/helpers/node_ops.go
✅ Files skipped from review due to trivial changes (1)
  • tests/far-operator/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/internal/helpers/node_ops.go
  • tests/far-operator/internal/farparams/const.go

Comment thread tests/far-operator/tests/far_destructive.go
Comment thread tests/far-operator/tests/far_destructive.go Outdated
@ugreener

ugreener commented Jul 3, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

1 similar comment
@ugreener

ugreener commented Jul 5, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@ugreener

ugreener commented Jul 5, 2026

Copy link
Copy Markdown
Author

/cancel 4.22-konflux-e2e-far-aws

@ugreener

ugreener commented Jul 7, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

1 similar comment
@ugreener

ugreener commented Jul 7, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@ugreener
ugreener force-pushed the feat/far-standalone-tests branch from 0f3ef1d to a2d97e6 Compare July 7, 2026 17:30
@ugreener

ugreener commented Jul 7, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

1 similar comment
@ugreener

ugreener commented Jul 7, 2026

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@ugreener ugreener changed the title Draft: Add 7 standalone FAR destructive remediation tests Draft: Add 7 standalone FAR destructive tests and improve test resiliency Jul 8, 2026
@ugreener ugreener changed the title Draft: Add 7 standalone FAR destructive tests and improve test resiliency Add 7 standalone FAR destructive tests and improve test resiliency Jul 8, 2026

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

TBD

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

TBD

Comment thread tests/far-operator/tests/far_destructive.go Outdated
@ugreener

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@razo7 razo7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Before I approve can we squash the 15 commits to ~4 logical commits before merge:

  1. Add standalone FAR destructive tests
  2. Fix pod-running smoke test race condition (far.go)
  3. Add randomized node selection and oc debug namespace fix (helpers)
  4. Add --randomize-all to test runner
    Also see inline comments below

Comment thread tests/far-operator/tests/far_destructive.go Outdated
Comment thread tests/far-operator/tests/far_destructive.go Outdated
Comment thread tests/far-operator/tests/far_destructive.go Outdated
Comment thread tests/far-operator/tests/far_destructive.go
Comment thread tests/far-operator/tests/far_destructive.go
Comment thread tests/far-operator/tests/far_destructive.go Outdated
Comment thread tests/far-operator/tests/far_destructive.go
Comment thread tests/far-operator/README.md Outdated
Comment thread tests/far-operator/tests/far_destructive.go Outdated
@ugreener
ugreener force-pushed the feat/far-standalone-tests branch from 34aa7af to 80d51d8 Compare July 14, 2026 09:37
@ugreener

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@abrugaro abrugaro removed their assignment Jul 14, 2026
@ugreener

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

2 similar comments
@ugreener

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@ugreener

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@razo7 razo7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great improvement since last review but not all the comments have been addressed (16 fully addressed, 1 deferred (RHWA-1330), 1 declined (OCP-66228), 1 partial (workload in OCP-70638), 1 pending (commit squash to ~4).

if err != nil && !k8serrors.IsAlreadyExists(err) {
Expect(err).ToNot(HaveOccurred(),
"Failed to create shared credentials Secret")
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This Secret containing AWS access key and secret key is created here but has no corresponding cleanup (AfterAll, DeferCleanup, or AfterSuite). Commit df5c1be removed the per-spec DeferCleanup (correctly — it was deleting the Secret between specs) but didn't add a suite-level replacement.

AWS credentials persist in the operator namespace indefinitely after test completion. Any principal with get secrets RBAC can extract them.

Suggestion: Add a suite-level cleanup using Defer

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in b14292b. Added AfterSuite in far_suite_test.go that deletes the credentials Secret after all specs complete.

DeferCleanup inside the guarded BeforeEach would fire after the first spec and delete the Secret that subsequent specs still need (the FAR CR references it via SharedSecretName during remediation). AfterSuite runs once after all specs, which is the correct scope for this one-time resource.


By("Verifying FAR NoSchedule taint removed after CR deletion")

Eventually(func(assertion Gomega) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This Eventually().Should(Succeed()) calls Fail() on timeout, which panics and stops execution of the rest of this JustAfterEach. The FARTemplate deletion (line 260) and node recovery safety net (lines 266-278) will NOT execute.

This is the same failure mode razo7 flagged earlier for the FAR CR Succeeded wait — that was correctly fixed with wait.PollUntilContextCancel (lines 195-238), but this new Eventually reintroduces the pattern.

Failure scenario: Controller slow to remove taint after CR deletion → timeout → Fail() → FARTemplate CR and node recovery skipped.

Suggestion: Replace with wait.PollUntilContextCancel + warning log, consistent with the pattern at lines 195-238.

@ugreener ugreener Jul 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in cc7e0af. Replaced the Eventually with wait.PollUntilContextCancel + warning log, matching the pattern at lines 196-238. The taint check now logs a warning on timeout and proceeds to the node recovery safety net instead of panicking.


Eventually(func(assertion Gomega) {
err := k8sClient.Create(ctx, farCR)
if err != nil && !k8serrors.IsAlreadyExists(err) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If deleteRemediationCR (line 665) hasn't fully finalized the old CR, Create returns IsAlreadyExists. The if guard skips the assertion, Eventually considers the iteration successful and exits the loop. The test then operates on the stale old CR.

If the old CR is already in Succeeded state, waitForRemediation may pass vacuously without exercising new fencing.

This was implemented per razo7's suggestion to handle the transient-network-error case (client timeout but server-side create succeeded). That case IS correct. But the semantics are broader — it also swallows the "old CR still finalizing" case.

Suggestion: At minimum, log when IsAlreadyExists is encountered for debuggability:

if k8serrors.IsAlreadyExists(err) {
    GinkgoWriter.Printf("INFO: FAR CR %s already exists, treating as success\n", farCR.GetName())
    return
}

Or: make deleteRemediationCR wait until the object is fully gone before returning.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in cc7e0af. Added a diagnostic log when IsAlreadyExists is encountered:

if k8serrors.IsAlreadyExists(err) {
    GinkgoWriter.Printf(
        "INFO: FAR CR %s already exists (prior delete may not have finalized), treating as success\n",
        farCR.GetName())
    return
}

deleteRemediationCR already polls until IsNotFound before createFARCR calls Create, so the stale-CR scenario requires the delete to time out (which already logs its own warning). This log creates a diagnostic breadcrumb linking the two events.


currentFARName = targetNode.Name

waitForRemediation(ctx, APIClient, targetNode.Name, oldBootID)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two gaps compared to other fencing tests and the PR's own README:

  1. No workload pod: All 5 non-leader fencing tests create a workload pod and verify eviction via the shared JustAfterEach. This test fences the leader node (which IS rebooted) but skips workload verification. razo7's comment said "every test should end with workload verification."

  2. No lease transfer assertion: The README claims "controller failover occurs" but the test only checks farDeployment.IsReady(). Compare with OCP-70636 (far_controller_lifecycle.go) which explicitly verifies lease.Spec.HolderIdentity changed. A deployment being Ready doesn't prove a different pod acquired the lease.

Suggestion:

  • Add workload pod creation + eviction check (reuse the non-leader worker target pattern)
  • Add lease transfer assertion (reuse the OCP-70636 pattern)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in bff464a. Added both:

1. Workload pod creation + eviction check: Creates a workload pod pinned to the leader node before fencing, waits for Running, then verifies eviction after remediation. Matches the non-leader worker target pattern.

2. Lease transfer assertion: After deployment readiness check, verifies lease.Spec.HolderIdentity is non-nil (controller lease has an active holder after the leader node reboot).

Comment thread tests/far-operator/tests/far_destructive.go
@ugreener
ugreener force-pushed the feat/far-standalone-tests branch 4 times, most recently from bff464a to 7441cf8 Compare July 15, 2026 10:49
@ugreener

Copy link
Copy Markdown
Author

Squashed to 4 commits as requested:

  1. 463ae62 far-operator: add standalone FAR destructive tests
  2. 9a18bf3 far-operator: fix racy pod-running smoke test (OCP-66026)
  3. 1c7b64c helpers: add randomized node selection and oc debug namespace fix
  4. 7441cf8 test-runner: add --randomize-all to ginkgo command

@ugreener
ugreener force-pushed the feat/far-standalone-tests branch from 7441cf8 to aa26dc4 Compare July 15, 2026 11:26
ugreener added 4 commits July 15, 2026 14:26
Add 6 standalone FAR remediation tests (OCP-61229, OCP-70638, OCP-65960,
OCP-67015, OCP-66203, OCP-70636) with resiliency improvements:
- Randomized worker node selection to avoid deterministic reuse
- CRI-O overlay cleanup to prevent corruption across reboots
- createFARCR/waitForRemediation helpers with retry logic
- Controller readiness pre-flight and diagnostic logging on failure
- Workload pod eviction verification in shared JustAfterEach
- Non-failing safety net cleanup with AddReportEntry on recovery failure

Tracking: RHWA-963
Replace two-step wait+count pattern with a single Eventually loop that
lists and filters running pods atomically. Prevents the race where
WaitForAllPodsInNamespaceRunning returns but a pod restarts before the
count assertion executes.
SelectWorkerNode now shuffles eligible nodes to prevent deterministic
reuse of the same worker across sequential destructive tests. RunOnNode
adds -n default to oc debug to avoid namespace permission errors in
locked-down CI environments.
@ugreener
ugreener force-pushed the feat/far-standalone-tests branch from aa26dc4 to c6b2b8f Compare July 15, 2026 11:27
@ugreener

Copy link
Copy Markdown
Author

/test 4.22-konflux-e2e-far-aws

@razo7 razo7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work @ugreener

@openshift-ci openshift-ci Bot added the lgtm label Jul 16, 2026
@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abrugaro, razo7, ugreener

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-merge-bot
openshift-merge-bot Bot merged commit 885fe19 into medik8s:main Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants