Skip to content

no fail mon tests#31212

Open
dgoodwin wants to merge 3 commits into
openshift:mainfrom
dgoodwin:no-fail-mon-tests
Open

no fail mon tests#31212
dgoodwin wants to merge 3 commits into
openshift:mainfrom
dgoodwin:no-fail-mon-tests

Conversation

@dgoodwin
Copy link
Copy Markdown
Contributor

@dgoodwin dgoodwin commented May 25, 2026

  • Add SpotCheck cluster stability to run monitortests for debug info but not fail junits
  • Port etcd leader changes test to a monitortest
  • Move etcd/scaling suite to a spot check job

Summary by CodeRabbit

  • New Features
    • Added SpotCheck cluster-stability mode for lightweight, faster health verification runs.
    • Added an etcd leader-changes monitor to detect excessive leader rotations during operations.
    • Added an option to suppress JUnit test result creation while still collecting artifacts and analysis data (useful for spot-check jobs).

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci openshift-ci Bot requested review from deads2k and jubittajohn May 25, 2026 14:10
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoodwin

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
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Walkthrough

This PR introduces a new SpotCheck cluster stability mode that enables lightweight monitoring runs without influencing test results. It migrates etcd leader-changes verification from Ginkgo tests to the monitor framework, updates multiple monitor tests to optionally suppress JUnit output, and integrates the new mode throughout the test infrastructure.

Changes

SpotCheck Cluster Stability Mode

Layer / File(s) Summary
Framework Constants and CLI
pkg/monitortestframework/types.go, pkg/test/ginkgo/test_suite.go, pkg/test/ginkgo/cmd_runsuite.go, pkg/testsuites/standard_suites.go
New SpotCheck constant and new SkipJunits boolean field added; CLI validation accepts SpotCheck; etcd scaling suite set to use SpotCheck.
SpotCheck monitor registry and default monitors
pkg/defaultmonitortests/types.go
NewMonitorTestsFor routes SpotCheck to newSpotCheckMonitorTests(info), which sets info.SkipJunits = true and registers a curated subset of monitors; universal registry updated to pass info to certain constructors; etcd-leader-changes registered in default set.
New etcd Leader-Changes Monitor Test
pkg/monitortests/etcd/leaderchanges/monitortest.go
New monitor that records start time, queries Prometheus for etcd_server_leader_changes_seen_total, computes an allowed threshold, and emits pass/fail JUnit cases; returns NotSupported for MicroShift.
Monitor tests SkipJunits support
pkg/monitortests/clusterversionoperator/clusterversionchecker/monitortest.go, pkg/monitortests/etcd/etcdloganalyzer/monitortest.go, pkg/monitortests/node/watchnodes/monitortest.go, pkg/monitortests/testframework/legacytestframeworkmonitortests/alerts_monitortest.go
Constructors updated to accept MonitorTestInitializationInfo and initialize a skipJunits flag; EvaluateTestsFromConstructedIntervals short-circuits to (nil, nil) when skipJunits is set to suppress JUnit test case generation.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'no fail mon tests' is vague and uses non-descriptive shorthand that doesn't clearly convey the changeset's main purpose. Use a more descriptive title such as 'Add SpotCheck cluster stability mode for monitortests without failing JUnits' to clearly communicate the primary change.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 test names are stable and deterministic. No dynamic content (pod names, timestamps, UUIDs, node names, IP addresses) found in test titles. All test names use static, descriptive strings.
Test Structure And Quality ✅ Passed No Ginkgo tests are being added or modified in this PR. The deleted Ginkgo test was replaced with a monitor test framework implementation, which is outside the scope of this Ginkgo test quality check.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. Changes are monitor tests (different framework), framework updates, and test suite configuration.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests added. Only monitor test infrastructure changes and removal of existing Ginkgo test; check not applicable to PR scope.
Topology-Aware Scheduling Compatibility ✅ Passed PR contains only Go source code changes to monitor tests and test configuration; no deployment manifests, operator code, or scheduling constraints that assume HA topology are being added or modified.
Ote Binary Stdout Contract ✅ Passed No OTE Binary Stdout Contract violations found. Modified code contains no process-level stdout writes (no main, init, TestMain, BeforeSuite, etc.) and no fmt.Print, log.Print, or klog to stdout.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR removes a Ginkgo test and adds a monitor test framework (not e2e tests). No new Ginkgo e2e tests added, so check is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 25, 2026
@dgoodwin
Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-gcp-ovn-etcd-scaling

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 25, 2026

@dgoodwin: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-gcp-ovn-etcd-scaling

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/87a97980-5843-11f1-8824-e7855c3d2249-0

@dgoodwin dgoodwin force-pushed the no-fail-mon-tests branch from 9f8b39b to 7525d8a Compare May 25, 2026 14:17
@dgoodwin
Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-ovn-etcd-scaling

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 25, 2026

@dgoodwin: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-ovn-etcd-scaling

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/81856720-5844-11f1-805b-5abfdac98a10-0

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@pkg/monitortests/etcd/leaderchanges/monitortest.go`:
- Around line 83-85: The code currently only treats
configv1.ExternalTopologyMode as external by setting etcdNamespace =
"clusters-.*" in monitortest.go; update the conditional around
infra.Status.ControlPlaneTopology to also treat the DualReplica topology as
external (or explicitly map it) so etcdNamespace is set appropriately for
dual-replica clusters and avoid querying in-cluster metrics when etcd is
external; modify the branch that sets etcdNamespace (referencing
infra.Status.ControlPlaneTopology, configv1.ExternalTopologyMode, and the
etcdNamespace variable) to include configv1.DualReplicaTopologyMode (or the
correct DualReplica constant) as an additional case.
🪄 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), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b9a3a38a-08e7-4578-92da-2d3d995a9356

📥 Commits

Reviewing files that changed from the base of the PR and between 8c50bc4 and 9f8b39b.

📒 Files selected for processing (11)
  • pkg/defaultmonitortests/types.go
  • pkg/monitortestframework/types.go
  • pkg/monitortests/clusterversionoperator/clusterversionchecker/monitortest.go
  • pkg/monitortests/etcd/etcdloganalyzer/monitortest.go
  • pkg/monitortests/etcd/leaderchanges/monitortest.go
  • pkg/monitortests/node/watchnodes/monitortest.go
  • pkg/monitortests/testframework/legacytestframeworkmonitortests/alerts_monitortest.go
  • pkg/test/ginkgo/cmd_runsuite.go
  • pkg/test/ginkgo/test_suite.go
  • pkg/testsuites/standard_suites.go
  • test/extended/etcd/leader_changes.go
💤 Files with no reviewable changes (1)
  • test/extended/etcd/leader_changes.go

Comment on lines +83 to +85
if infra.Status.ControlPlaneTopology == configv1.ExternalTopologyMode {
etcdNamespace = "clusters-.*"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Handle DualReplica topology as unsupported (or map it explicitly).

At Line 83, only ExternalTopologyMode is handled. DualReplica clusters can run etcd externally, so querying etcd_server_leader_changes_seen_total as if in-cluster can return no series and trigger false failures.

Suggested fix
-	etcdNamespace := "openshift-etcd"
-	if infra.Status.ControlPlaneTopology == configv1.ExternalTopologyMode {
+	etcdNamespace := "openshift-etcd"
+	if infra.Status.ControlPlaneTopology == configv1.DualReplicaTopologyMode {
+		return nil, nil, &monitortestframework.NotSupportedError{
+			Reason: "DualReplica topology not supported for etcd leader-change monitor",
+		}
+	}
+	if infra.Status.ControlPlaneTopology == configv1.ExternalTopologyMode {
 		etcdNamespace = "clusters-.*"
 	}
🤖 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 `@pkg/monitortests/etcd/leaderchanges/monitortest.go` around lines 83 - 85, The
code currently only treats configv1.ExternalTopologyMode as external by setting
etcdNamespace = "clusters-.*" in monitortest.go; update the conditional around
infra.Status.ControlPlaneTopology to also treat the DualReplica topology as
external (or explicitly map it) so etcdNamespace is set appropriately for
dual-replica clusters and avoid querying in-cluster metrics when etcd is
external; modify the branch that sets etcdNamespace (referencing
infra.Status.ControlPlaneTopology, configv1.ExternalTopologyMode, and the
etcdNamespace variable) to include configv1.DualReplicaTopologyMode (or the
correct DualReplica constant) as an additional case.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@pkg/monitortests/etcd/leaderchanges/monitortest.go`:
- Around line 119-123: The code truncates Prometheus leader-change counts by
converting leaderChanges (vec[0].Value, a model.SampleValue/float) to int before
comparing against allowedLeaderChanges; change the comparison to use
floating-point so no truncation occurs (e.g., compare leaderChanges as a float64
to float64(allowedLeaderChanges)), update any fmt.Sprintf/return messages to
format the original float value (leaderChanges) rather than the truncated int,
and keep the existing symbols (leaderChanges, allowedLeaderChanges,
numberOfRevisions, vec, failJunit) to locate and apply the change.
🪄 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), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: a97e84c4-7b22-4803-85fb-5ad06593327b

📥 Commits

Reviewing files that changed from the base of the PR and between 9f8b39b and 7525d8a.

📒 Files selected for processing (4)
  • pkg/defaultmonitortests/types.go
  • pkg/monitortests/etcd/leaderchanges/monitortest.go
  • pkg/testsuites/standard_suites.go
  • test/extended/etcd/leader_changes.go
💤 Files with no reviewable changes (1)
  • test/extended/etcd/leader_changes.go

Comment on lines +119 to +123
allowedLeaderChanges := numberOfRevisions * 3
leaderChanges := vec[0].Value

if int(leaderChanges) > allowedLeaderChanges {
return nil, failJunit(fmt.Sprintf(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid truncating Prometheus leader-change counts before threshold checks.

leaderChanges is taken from vec[0].Value (model.SampleValue, a float). Converting to int truncates and can undercount near the boundary.

Suggested fix
-	allowedLeaderChanges := numberOfRevisions * 3
-	leaderChanges := vec[0].Value
-
-	if int(leaderChanges) > allowedLeaderChanges {
+	allowedLeaderChanges := numberOfRevisions * 3
+	leaderChanges := vec[0].Value
+
+	if leaderChanges > model.SampleValue(allowedLeaderChanges) {
 		return nil, failJunit(fmt.Sprintf(
 			"observed %s leader changes (expected at most %d) in %s: Leader changes are a result of stopping the etcd leader process or from latency (disk or network), review etcd performance metrics",
 			leaderChanges, allowedLeaderChanges, testDuration,
 		)), nil
 	}
🤖 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 `@pkg/monitortests/etcd/leaderchanges/monitortest.go` around lines 119 - 123,
The code truncates Prometheus leader-change counts by converting leaderChanges
(vec[0].Value, a model.SampleValue/float) to int before comparing against
allowedLeaderChanges; change the comparison to use floating-point so no
truncation occurs (e.g., compare leaderChanges as a float64 to
float64(allowedLeaderChanges)), update any fmt.Sprintf/return messages to format
the original float value (leaderChanges) rather than the truncated int, and keep
the existing symbols (leaderChanges, allowedLeaderChanges, numberOfRevisions,
vec, failJunit) to locate and apply the change.

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-trt
Copy link
Copy Markdown

openshift-trt Bot commented May 25, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New tests seen in this PR at sha: 7525d8a

  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes cleanup" [Total: 12, Pass: 12, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes collection" [Total: 10, Pass: 10, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes interval construction" [Total: 10, Pass: 10, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes preparation" [Total: 12, Pass: 12, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes setup" [Total: 10, Pass: 10, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes test evaluation" [Total: 10, Pass: 10, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][Jira:"etcd"] monitor test etcd-leader-changes writing to storage" [Total: 12, Pass: 12, Fail: 0, Flake: 0]
  • "[Monitor:etcd-leader-changes][sig-etcd] etcd leader changes are not excessive" [Total: 10, Pass: 10, Fail: 0, Flake: 0]

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant