Skip to content

OTA-1606: add test OCP-54887#1349

Open
dis016 wants to merge 1 commit intoopenshift:mainfrom
dis016:auto_33876
Open

OTA-1606: add test OCP-54887#1349
dis016 wants to merge 1 commit intoopenshift:mainfrom
dis016:auto_33876

Conversation

@dis016
Copy link

@dis016 dis016 commented Mar 13, 2026

OTA-1606: add test https://polarion.engineering.redhat.com/polarion/#/project/OSE/workitem?id=OCP-54887
/cc @jiajliu @JianLi-RH @jhou1

Summary by CodeRabbit

  • Tests
    • Added end-to-end validation to confirm the default cluster version channel matches the expected stable-. format and that the latest update is verified.
    • Retained previously migrated/commented test notes for future review.
    • Note: a duplicate instance of the new validation appears and should be consolidated.

@openshift-ci openshift-ci bot requested a review from jhou1 March 13, 2026 12:54
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 13, 2026

@dis016: This pull request references OTA-1606 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

OTA-1606: add test https://polarion.engineering.redhat.com/polarion/#/project/OSE/workitem?id=OCP-54887
/cc @jiajliu @JianLi-RH @jhou1

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from JianLi-RH and jiajliu March 13, 2026 12:54
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 13, 2026
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Walkthrough

Adds an end-to-end test that fetches ClusterVersion, checks Desired.Version and history Verified flag, and asserts the configured channel equals the computed stable-. prefix. Adds a utility function to compute the expected channel prefix from a semantic version. Duplicate test block present.

Changes

Cohort / File(s) Summary
Test Implementation
test/cvo/cvo.go
Adds new end-to-end test block "The default channel should be correct" that: fetches ClusterVersion version, asserts non-empty Status.Desired.Version, verifies latest history entry has Verified == true, extracts spec.channel, checks it matches stable-<major>.<minor>. Contains a duplicated instance of the same test block and keeps commented-out migrated tests.
Utility Function
test/util/util.go
Adds public GetExpectedChannelPrefix(version string) string which parses major.minor from a semantic version (using fmt.Sscanf) and returns stable-<major>.<minor>; returns empty string on parse failure. Adds fmt import if required.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning Test violates single responsibility principle by asserting four distinct concerns and uses context.Background() without explicit timeouts for cluster API operations. Refactor test into multiple focused blocks and add explicit context.WithTimeout() calls with appropriate durations to all cluster API operations.
Title check ❓ Inconclusive The title 'OTA-1606: add test OCP-54887' directly references the issue tracker IDs but lacks descriptive detail about what the test actually does. Consider revising the title to include what is being tested, such as 'OTA-1606: add test for default channel format validation' to provide more context about the main change.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Stable And Deterministic Test Names ✅ Passed Test name 'The default channel should be correct' contains no dynamic elements, timestamps, UUIDs, pod/node names, or other non-deterministic values.
Microshift Test Compatibility ✅ Passed The new test uses ClusterVersion API from config.openshift.io/v1 which is unavailable on MicroShift, but is properly protected with util.SkipIfMicroshift() runtime check that skips execution on MicroShift clusters.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The test is a pure API-level validation that only reads and validates ClusterVersion resource properties and channel naming conventions, with no multi-node or HA cluster assumptions, making it fully compatible with SNO deployments.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new test and utility function contain no IPv4 assumptions or external connectivity requirements, using only cluster-internal Kubernetes APIs and local string parsing.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can validate your CodeRabbit configuration file in your editor.

If your editor has YAML language server, you can enable auto-completion and validation by adding # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json at the top of your CodeRabbit configuration file.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 13, 2026

@dis016: This pull request references OTA-1606 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

OTA-1606: add test https://polarion.engineering.redhat.com/polarion/#/project/OSE/workitem?id=OCP-54887
/cc @jiajliu @JianLi-RH @jhou1

Summary by CodeRabbit

  • Tests
  • Added validation tests for cluster version configuration and channel verification.
  • Enhanced test coverage to ensure cluster builds are properly signed and default channels match expected format specifications.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 13, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dis016
Once this PR has been reviewed and has the lgtm label, please assign wking 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

Copy link

@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

🧹 Nitpick comments (1)
test/cvo/cvo.go (1)

103-115: Remove commented-out test block before merge.

Keeping this large commented section adds noise and makes the suite harder to scan; prefer deleting it and relying on Git history if needed.

🧹 Proposed cleanup
-	/*// Migrated from case NonHyperShiftHOST-Author:dis-High-OCP-33876-Clusterversion status has metadata stored
-	g.It("Clusterversion status has metadata stored", func() {
-		ctx := context.Background()
-		err := util.SkipIfHypershift(ctx, restCfg)
-		o.Expect(err).NotTo(o.HaveOccurred(), "Failed to determine if cluster is HyperShift")
-		err = util.SkipIfMicroshift(ctx, restCfg)
-		o.Expect(err).NotTo(o.HaveOccurred(), "Failed to determine if cluster is MicroShift")
-
-		g.By("Checking that the Clusterversion status has metadata stored")
-		clusterversion, err := kubeClient.ConfigV1().ClusterVersions().Get(ctx, "version", metav1.GetOptions{})
-		o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get Clusterversion")
-	})*/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/cvo/cvo.go` around lines 103 - 115, Remove the large commented-out test
block that begins with "Clusterversion status has metadata stored" (the /* ...
*/ block containing util.SkipIfHypershift, util.SkipIfMicroshift, and the call
to kubeClient.ConfigV1().ClusterVersions().Get) from test/cvo/cvo.go so the file
no longer contains the dead test; rely on Git history if the code is needed
later.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/cvo/cvo.go`:
- Line 116: Fix the typos in the migrated test text and log message: locate the
comment/string containing "NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The
default channel should be corret" and change "corret" to "correct", and locate
the log/test message containing the misspelled "Deafault" and change it to
"Default" so the test output and logs read correctly.

---

Nitpick comments:
In `@test/cvo/cvo.go`:
- Around line 103-115: Remove the large commented-out test block that begins
with "Clusterversion status has metadata stored" (the /* ... */ block containing
util.SkipIfHypershift, util.SkipIfMicroshift, and the call to
kubeClient.ConfigV1().ClusterVersions().Get) from test/cvo/cvo.go so the file no
longer contains the dead test; rely on Git history if the code is needed later.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 442ae3f3-f023-4886-af29-412eef42c3dc

📥 Commits

Reviewing files that changed from the base of the PR and between 602f35f and 811b2f6.

📒 Files selected for processing (2)
  • test/cvo/cvo.go
  • test/util/util.go

o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get Clusterversion")
})*/

// Migrated from case NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The default channel should be corret
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix typos in migrated case text and log message.

Line 116 has “corret”, and Line 148 has “Deafault”; these should be corrected for clarity in test output/logs.

✏️ Proposed wording fix
-	// Migrated from case NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The default channel should be corret
+	// Migrated from case NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The default channel should be correct
...
-		logger.Info("Deafault channel for version is correct", "version:", version, "channel:", channel)
+		logger.Info("Default channel for version is correct", "version:", version, "channel:", channel)

Also applies to: 148-148

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/cvo/cvo.go` at line 116, Fix the typos in the migrated test text and log
message: locate the comment/string containing
"NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The default channel should be
corret" and change "corret" to "correct", and locate the log/test message
containing the misspelled "Deafault" and change it to "Default" so the test
output and logs read correctly.

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 13, 2026

@dis016: This pull request references OTA-1606 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

OTA-1606: add test https://polarion.engineering.redhat.com/polarion/#/project/OSE/workitem?id=OCP-54887
/cc @jiajliu @JianLi-RH @jhou1

Summary by CodeRabbit

  • Tests
  • Added end-to-end validation to confirm the default cluster version channel matches the expected stable-. format and that the latest update is verified.
  • Retained previously migrated/commented test notes for future review.
  • Note: a duplicate instance of the new validation appears and should be consolidated.

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link

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

♻️ Duplicate comments (1)
test/cvo/cvo.go (1)

116-148: ⚠️ Potential issue | 🟡 Minor

Fix remaining typos in migrated text and log message.

Line 116 should use correct, and Line 148 should use Default.

✏️ Suggested patch
-	// Migrated from case NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The default channel should be corret
+	// Migrated from case NonHyperShiftHOST-Author:dis-Medium-OCP-54887-The default channel should be correct
...
-		logger.Info("Deafault channel for version is correct", "version:", version, "channel:", channel)
+		logger.Info("Default channel for version is correct", "version:", version, "channel:", channel)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/cvo/cvo.go` around lines 116 - 148, Update the test description string
in the Ginkgo spec (the g.It call with text "The default channel should be
corret") to use "correct", and fix the logger.Info message that currently reads
"Deafault channel for version is correct" to "Default channel for version is
correct" (refer to the g.It invocation and the logger.Info(...) call near the
end of the test).
🧹 Nitpick comments (2)
test/cvo/cvo.go (2)

146-147: Add an explicit assertion for parsed expected channel.

Assert expectedChannelPrefix is non-empty before equality check so parse failures are surfaced with a clearer cause.

✅ Suggested patch
 		expectedChannelPrefix := util.GetExpectedChannelPrefix(version)
+		o.Expect(expectedChannelPrefix).NotTo(o.BeEmpty(), "Failed to derive expected channel from version %s", version)
 		o.Expect(channel).To(o.Equal(expectedChannelPrefix), "Expected channel to be %s based on version %s, but got %s", expectedChannelPrefix, version, channel)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/cvo/cvo.go` around lines 146 - 147, The test currently compares channel
to util.GetExpectedChannelPrefix(version) without checking that the parsed
expectedChannelPrefix is valid; add an explicit assertion that the value
returned by util.GetExpectedChannelPrefix(version) (the variable
expectedChannelPrefix) is non-empty (e.g., using
o.Expect(expectedChannelPrefix).ToNot(o.BeEmpty(), "...")) before the equality
assertion so parse failures surface clearly, then proceed with the existing
o.Expect(channel).To(o.Equal(expectedChannelPrefix), ...) check.

103-114: Remove the commented-out test body.

This block is dead code in its current form. Please remove it (or replace it with a short tracking comment/issue reference) to keep the E2E test file focused.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/cvo/cvo.go` around lines 103 - 114, Remove the dead, commented-out test
block containing the g.It("Clusterversion status has metadata stored") body
(which references ctx, util.SkipIfHypershift, util.SkipIfMicroshift, and
kubeClient.ConfigV1().ClusterVersions().Get) — either delete the entire /* ...
*/ commented test or replace it with a concise tracking comment or issue ID;
ensure no leftover commented code remains inside the cvo.go test file so the E2E
test stays focused and clean.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@test/cvo/cvo.go`:
- Around line 116-148: Update the test description string in the Ginkgo spec
(the g.It call with text "The default channel should be corret") to use
"correct", and fix the logger.Info message that currently reads "Deafault
channel for version is correct" to "Default channel for version is correct"
(refer to the g.It invocation and the logger.Info(...) call near the end of the
test).

---

Nitpick comments:
In `@test/cvo/cvo.go`:
- Around line 146-147: The test currently compares channel to
util.GetExpectedChannelPrefix(version) without checking that the parsed
expectedChannelPrefix is valid; add an explicit assertion that the value
returned by util.GetExpectedChannelPrefix(version) (the variable
expectedChannelPrefix) is non-empty (e.g., using
o.Expect(expectedChannelPrefix).ToNot(o.BeEmpty(), "...")) before the equality
assertion so parse failures surface clearly, then proceed with the existing
o.Expect(channel).To(o.Equal(expectedChannelPrefix), ...) check.
- Around line 103-114: Remove the dead, commented-out test block containing the
g.It("Clusterversion status has metadata stored") body (which references ctx,
util.SkipIfHypershift, util.SkipIfMicroshift, and
kubeClient.ConfigV1().ClusterVersions().Get) — either delete the entire /* ...
*/ commented test or replace it with a concise tracking comment or issue ID;
ensure no leftover commented code remains inside the cvo.go test file so the E2E
test stays focused and clean.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 59280b20-64c8-4604-8018-90e9775627a4

📥 Commits

Reviewing files that changed from the base of the PR and between 811b2f6 and fe9b7a1.

📒 Files selected for processing (2)
  • test/cvo/cvo.go
  • test/util/util.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/util/util.go

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 13, 2026

@dis016: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-agnostic-ovn-techpreview-serial-2of3 fe9b7a1 link true /test e2e-agnostic-ovn-techpreview-serial-2of3
ci/prow/verify-update fe9b7a1 link true /test verify-update
ci/prow/e2e-aws-ovn-techpreview fe9b7a1 link true /test e2e-aws-ovn-techpreview
ci/prow/e2e-agnostic-ovn fe9b7a1 link true /test e2e-agnostic-ovn

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

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants