Skip to content

chore: refactor e2e test diagnostic#1144

Open
simonpasquier wants to merge 1 commit into
rhobs:mainfrom
simonpasquier:refactor-e2e-test-diagnostic
Open

chore: refactor e2e test diagnostic#1144
simonpasquier wants to merge 1 commit into
rhobs:mainfrom
simonpasquier:refactor-e2e-test-diagnostic

Conversation

@simonpasquier

Copy link
Copy Markdown
Contributor

Follow-up of #1115

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 586f9467-4117-48b6-8ee1-532d16bebb8b

📥 Commits

Reviewing files that changed from the base of the PR and between 54342f2 and 0d9726c.

📒 Files selected for processing (11)
  • pkg/apis/uiplugin/v1alpha1/types.go
  • test/e2e/framework/framework.go
  • test/e2e/framework/uiplugin.go
  • test/e2e/monitoring_stack_controller_test.go
  • test/e2e/observability_installer_test.go
  • test/e2e/operator_metrics_test.go
  • test/e2e/po_admission_webhook_test.go
  • test/e2e/prometheus_operator_test.go
  • test/e2e/thanos_querier_controller_test.go
  • test/e2e/uiplugin_cluster_health_analyzer_test.go
  • test/e2e/uiplugin_test.go
✅ Files skipped from review due to trivial changes (3)
  • test/e2e/operator_metrics_test.go
  • test/e2e/prometheus_operator_test.go
  • test/e2e/monitoring_stack_controller_test.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • test/e2e/uiplugin_test.go
  • test/e2e/framework/uiplugin.go
  • test/e2e/thanos_querier_controller_test.go
  • test/e2e/po_admission_webhook_test.go
  • test/e2e/observability_installer_test.go
  • test/e2e/uiplugin_cluster_health_analyzer_test.go
  • test/e2e/framework/framework.go

📝 Walkthrough

Walkthrough

The PR updates e2e failure diagnostics in the framework and test callsites. DumpOnFailure now logs a diagnostics header, DebugNamespace becomes DebugNamespaces with an internal namespace dump logger, and DebugUIPlugin is added for named UIPlugin inspection. The e2e tests switch to the new namespace helper, the cluster health analyzer test uses the new UIPlugin helper, and pkg/apis/uiplugin/v1alpha1/types.go adds exported UIPlugin name constants.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: refactoring e2e test diagnostics.
Description check ✅ Passed The description is brief but still related as a follow-up to the linked e2e diagnostics work.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from jan--f and jgbernalp June 30, 2026 15:53
@openshift-ci

openshift-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: simonpasquier

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

@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/uiplugin_cluster_health_analyzer_test.go`:
- Around line 34-40: Register the UIPlugin and namespace failure diagnostics
before the first potentially failing assertion in the test so a create failure
still captures them: in the test that calls resetMonitoringUIPlugin and
f.K8sClient.Create, move f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name)) ahead
of the create/assertion, and add failure dumping for prometheusRuleNamespace as
well since the later PrometheusRule setup and wait checks depend on it. Keep the
existing uiPluginInstallNS dump, but ensure both namespaces and the plugin dump
are registered early enough to cover all failure paths in this test.
🪄 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 YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 8fb8f16a-552e-4378-b48e-08856be3bc7d

📥 Commits

Reviewing files that changed from the base of the PR and between 78d39b1 and 54342f2.

📒 Files selected for processing (10)
  • test/e2e/framework/framework.go
  • test/e2e/framework/uiplugin.go
  • test/e2e/monitoring_stack_controller_test.go
  • test/e2e/observability_installer_test.go
  • test/e2e/operator_metrics_test.go
  • test/e2e/po_admission_webhook_test.go
  • test/e2e/prometheus_operator_test.go
  • test/e2e/thanos_querier_controller_test.go
  • test/e2e/uiplugin_cluster_health_analyzer_test.go
  • test/e2e/uiplugin_test.go

Comment on lines +34 to +40
f.DumpOnFailure(t, f.DebugNamespaces(uiPluginInstallNS))

plugin := resetMonitoringUIPlugin(t)
err = f.K8sClient.Create(t.Context(), plugin)
assert.NilError(t, err, "failed to create monitoring UIPlugin")

f.DumpOnFailure(t, dumpUIPluginDebug(plugin.Name))
f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name))

@coderabbitai coderabbitai Bot Jun 30, 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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Register all relevant failure diagnostics before the first assertion can fail.

plugin.Name is known before the create, so f.DebugUIPlugin(plugin.Name) should be registered before Line 37; otherwise a create failure skips the new UIPlugin dump entirely. Also, this test later creates the PrometheusRule in prometheusRuleNamespace, but the namespace dump only covers uiPluginInstallNS, so failures in the alert/incident waits miss the rule namespace events and objects.

Suggested fix
-	f.DumpOnFailure(t, f.DebugNamespaces(uiPluginInstallNS))
+	f.DumpOnFailure(t, f.DebugNamespaces(uiPluginInstallNS, prometheusRuleNamespace))

 	plugin := resetMonitoringUIPlugin(t)
+	f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name))
 	err = f.K8sClient.Create(t.Context(), plugin)
 	assert.NilError(t, err, "failed to create monitoring UIPlugin")
-
-	f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name))

As per path instructions, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
f.DumpOnFailure(t, f.DebugNamespaces(uiPluginInstallNS))
plugin := resetMonitoringUIPlugin(t)
err = f.K8sClient.Create(t.Context(), plugin)
assert.NilError(t, err, "failed to create monitoring UIPlugin")
f.DumpOnFailure(t, dumpUIPluginDebug(plugin.Name))
f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name))
f.DumpOnFailure(t, f.DebugNamespaces(uiPluginInstallNS, prometheusRuleNamespace))
plugin := resetMonitoringUIPlugin(t)
f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name))
err = f.K8sClient.Create(t.Context(), plugin)
assert.NilError(t, err, "failed to create monitoring UIPlugin")
🤖 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/uiplugin_cluster_health_analyzer_test.go` around lines 34 - 40,
Register the UIPlugin and namespace failure diagnostics before the first
potentially failing assertion in the test so a create failure still captures
them: in the test that calls resetMonitoringUIPlugin and f.K8sClient.Create,
move f.DumpOnFailure(t, f.DebugUIPlugin(plugin.Name)) ahead of the
create/assertion, and add failure dumping for prometheusRuleNamespace as well
since the later PrometheusRule setup and wait checks depend on it. Keep the
existing uiPluginInstallNS dump, but ensure both namespaces and the plugin dump
are registered early enough to cover all failure paths in this test.

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.

there's no need to dump the plugin data if it wasn't created.

@simonpasquier simonpasquier force-pushed the refactor-e2e-test-diagnostic branch from 54342f2 to 9a23f8c Compare July 1, 2026 07:52
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@simonpasquier simonpasquier force-pushed the refactor-e2e-test-diagnostic branch from 9a23f8c to 0d9726c Compare July 1, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant