fix: wait for exporter to go offline - #968
Conversation
Instead of sleeping, use WaitForExporterOffline Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
📝 WalkthroughWalkthroughThe end-to-end test cleanup now waits for controller processing and exporter offline confirmation after stopping exporters. ChangesExporter cleanup synchronization
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" 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. Comment |
There was a problem hiding this comment.
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 `@e2e/test/exit_on_lease_end_test.go`:
- Around line 71-74: Update WaitForExporterOffline in utils.go so kubectl
command errors are retried rather than treated as success, and only return
successfully when the exporter status explicitly reports the intended offline
condition, such as Online=False. Preserve the existing cleanup synchronization
used by tracker.StopAll.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 29e8525c-7eb4-497b-a520-834dab90e1a7
📒 Files selected for processing (1)
e2e/test/exit_on_lease_end_test.go
| // Stop any running exporter and wait for the controller to fully | ||
| // process the disconnection before the next test starts a new one. | ||
| tracker.StopAll() | ||
| time.Sleep(time.Second) | ||
| WaitForExporterOffline("test-exporter-exit-on-lease-end") |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Require a successful offline-status read before starting the next test.
Line 74 calls WaitForExporterOffline, but that helper ignores Kubectl errors and treats empty output as offline. A transient kubectl get failure can therefore let AfterEach continue before the controller processes the stopped exporter. This defeats the cleanup synchronization and can cause cross-test interference.
Update e2e/test/utils.go so command errors retry and the predicate requires the intended offline condition, such as Online=False.
🤖 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 `@e2e/test/exit_on_lease_end_test.go` around lines 71 - 74, Update
WaitForExporterOffline in utils.go so kubectl command errors are retried rather
than treated as success, and only return successfully when the exporter status
explicitly reports the intended offline condition, such as Online=False.
Preserve the existing cleanup synchronization used by tracker.StopAll.
There was a problem hiding this comment.
@mangelajo, agreed. The finding remains open until WaitForExporterOffline retries command errors and requires an explicit offline status.
🐇
You are interacting with an AI system.
Instead of sleeping, use WaitForExporterOffline