Skip to content

NO-JIRA: migrate ocp-53906 from otp to cvo repo#1347

Open
jiajliu wants to merge 1 commit intoopenshift:mainfrom
jiajliu:ocp-53906
Open

NO-JIRA: migrate ocp-53906 from otp to cvo repo#1347
jiajliu wants to merge 1 commit intoopenshift:mainfrom
jiajliu:ocp-53906

Conversation

@jiajliu
Copy link
Contributor

@jiajliu jiajliu commented Mar 13, 2026

This PR migrates test case 53906 from openshift-tests-private into cluster-version-operator, which validates CVO correctly parses release architecture into ClusterVersion status. Additionally, it adds the oc helper function AdmReleaseInfo() to support the test.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6dd92cd8-cfa8-4f18-b061-7c02a2dd51b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Adds a new CVO e2e test that verifies ClusterVersion architecture info from the release image versus cluster nodes, extends the OC client with Extract and AdmReleaseInfo helpers to obtain release JSON, and appends a test entry to the CVO test manifest.

Changes

Cohort / File(s) Summary
Test Manifest Configuration
\.openshift-tests-extension/openshift_payload_cluster-version-operator.json
Appended a new test entry: "[Jira:"Cluster Version Operator"] cluster-version-operator should have correct architecture info in clusterversion status".
Architecture Verification Test
test/cvo/cvo.go
Added an e2e test that calls AdmReleaseInfo, parses release.openshift.io/architecture, lists nodes, reads ClusterVersion ReleaseAccepted condition, and asserts message matches single-arch or "Multi". Added imports: encoding/json, time, k8s.io/apimachinery/pkg/util/sets, and lib/resourcemerge.
OC API Interface Extensions
test/oc/api/api.go
Added public types ReleaseInfoOptions, ExtractOptions and new OC interface methods AdmReleaseInfo(ReleaseInfoOptions) (string, error) and Extract(ExtractOptions) error.
OC CLI Implementation
test/oc/cli/cli.go
Implemented client.AdmReleaseInfo (creates temp dir, extracts pull-secret via Extract, runs oc adm release info --insecure -a <pullSecret> -o json with optional image) and client.Extract (runs oc extract with resource/namespace/to). Added os, path/filepath imports.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test
    participant OC as OC client
    participant Registry as Release Image/Registry
    participant API as API Server (config/v1 ClusterVersion)
    participant Nodes as API Server (core/v1 Nodes)

    Test->>OC: Extract pull-secret (resource/namespace --to)
    OC-->>Test: pull-secret path
    Test->>OC: AdmReleaseInfo (--insecure -a pullSecret -o json [--image])
    OC->>Registry: fetch release metadata
    Registry-->>OC: release JSON (includes release.openshift.io/architecture)
    OC-->>Test: release JSON
    Test->>API: Get ClusterVersion
    API-->>Test: ClusterVersion ReleaseAccepted condition/message
    Test->>Nodes: List Nodes
    Nodes-->>Test: Node architectures
    Test->>Test: Compare release arch vs node archs and assert CV message
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Test code has missing os import, discards List() result causing empty nodes variable, and lacks required quality elements. Add os import, fix nodes assignment on line 46, add assertion messages, replace context.Background() with timeouts, split into two tests, and add BeforeEach/AfterEach blocks.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates this PR migrates a test case (ocp-53906) from the otp repository to the cvo repository, which aligns with the changes adding a new test to the cluster-version-operator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed Both test names are static, descriptive strings with no dynamic information, generated identifiers, timestamps, pod/node names, or variable interpolations. Test title clearly indicates what is being validated.

✏️ 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.

@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: jiajliu
Once this PR has been reviewed and has the lgtm label, please assign pratikmahajan 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

🤖 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`:
- Around line 122-162: The release architecture extracted into releaseArch must
be required, not treated as best-effort: after parsing releaseInfo (the
releaseArch variable populated from the nested releaseInfo map) add an assertion
that releaseArch is non-empty (fail fast via o.Expect) so missing metadata fails
the test; then in the non-heterogeneous branch (where you currently check node
architectures and compute expectedArch) assert that releaseArch matches
expectedArch (compare strings or containment against expectedArch) before
asserting cvArchInfo contains the architecture, and use the symbols releaseArch,
heterogeneousArchKeyword, expectedArch and cvArchInfo to locate where to add
these checks.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 19670f68-e7a7-4b99-b112-f2adb001844c

📥 Commits

Reviewing files that changed from the base of the PR and between ffe4646 and e052752.

📒 Files selected for processing (4)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json
  • test/cvo/cvo.go
  • test/oc/api/api.go
  • test/oc/cli/cli.go

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.

🧹 Nitpick comments (1)
test/oc/cli/cli.go (1)

130-133: Validate ExtractOptions before building the command.

At Line 131, empty Resource/Namespace/To values fall through to oc and produce less actionable errors. Add a small guard for faster failure.

Proposed diff
 func (c *client) Extract(o api.ExtractOptions) error {
+	if o.Resource == "" || o.Namespace == "" || o.To == "" {
+		return fmt.Errorf("extract options must include resource, namespace, and to")
+	}
 	args := []string{"extract", o.Resource, "-n", o.Namespace, "--confirm", fmt.Sprintf("--to=%s", o.To)}
 	_, err := c.executor.Run(args...)
 	return err
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/oc/cli/cli.go` around lines 130 - 133, Validate the incoming
api.ExtractOptions fields in client.Extract before constructing the oc args:
check that o.Resource, o.Namespace and o.To are non-empty and return a clear
error immediately if any are missing so we fail fast instead of invoking
c.executor.Run with invalid args; update the Extract method (function
client.Extract) to perform these guards and return an explanatory error message
naming the missing field(s) before calling c.executor.Run.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/oc/cli/cli.go`:
- Around line 130-133: Validate the incoming api.ExtractOptions fields in
client.Extract before constructing the oc args: check that o.Resource,
o.Namespace and o.To are non-empty and return a clear error immediately if any
are missing so we fail fast instead of invoking c.executor.Run with invalid
args; update the Extract method (function client.Extract) to perform these
guards and return an explanatory error message naming the missing field(s)
before calling c.executor.Run.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 33ec5fde-18e8-4b58-af96-5cce30d23827

📥 Commits

Reviewing files that changed from the base of the PR and between e052752 and 6d20a7d.

📒 Files selected for processing (4)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json
  • test/cvo/cvo.go
  • test/oc/api/api.go
  • test/oc/cli/cli.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json

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.

🧹 Nitpick comments (1)
test/oc/cli/cli.go (1)

95-128: Implementation looks solid for test purposes.

The method properly handles:

  • Temp directory lifecycle with deferred cleanup
  • Error propagation with descriptive messages
  • Optional image argument

One minor observation: the method assumes the pull-secret will always extract to .dockerconfigjson. While this is the standard filename for the pull-secret in openshift-config, you might consider adding a file existence check before passing it to oc adm release info for clearer error messages if extraction produces unexpected results.

💡 Optional: Add file existence check
 	// Use the extracted pull-secret
 	pullSecret := filepath.Join(tempDir, ".dockerconfigjson")
+	if _, err := os.Stat(pullSecret); err != nil {
+		return "", fmt.Errorf("pull-secret file not found at %s: %w", pullSecret, err)
+	}
 	args := []string{"adm", "release", "info", "-a", pullSecret, "--insecure", "-o", "json"}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/oc/cli/cli.go` around lines 95 - 128, Add a file-existence check for the
extracted pull secret before invoking oc: after calling c.Extract(...) and
computing pullSecret := filepath.Join(tempDir, ".dockerconfigjson"), verify that
the file exists and is readable (os.Stat or equivalent) and return a descriptive
error (including tempDir and expected filename) if it does not; keep the rest of
AdmReleaseInfo (the tempDir cleanup, Extract call, and executor.Run invocation)
unchanged and reference pullSecret in the error message so failures are easier
to debug.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/oc/cli/cli.go`:
- Around line 95-128: Add a file-existence check for the extracted pull secret
before invoking oc: after calling c.Extract(...) and computing pullSecret :=
filepath.Join(tempDir, ".dockerconfigjson"), verify that the file exists and is
readable (os.Stat or equivalent) and return a descriptive error (including
tempDir and expected filename) if it does not; keep the rest of AdmReleaseInfo
(the tempDir cleanup, Extract call, and executor.Run invocation) unchanged and
reference pullSecret in the error message so failures are easier to debug.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: e86256b9-1cfd-45a3-a225-0b1adeb18e15

📥 Commits

Reviewing files that changed from the base of the PR and between 6d20a7d and a61e6b8.

📒 Files selected for processing (4)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json
  • test/cvo/cvo.go
  • test/oc/api/api.go
  • test/oc/cli/cli.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/cvo/cvo.go
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json

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/oc/cli/cli.go (1)

134-137: Validate ExtractOptions fields before invoking oc.

Fail fast on missing required fields to return clearer errors than downstream CLI failures.

Proposed refactor
 func (c *client) Extract(o api.ExtractOptions) error {
+	if strings.TrimSpace(o.Resource) == "" || strings.TrimSpace(o.Namespace) == "" || strings.TrimSpace(o.To) == "" {
+		return fmt.Errorf("resource, namespace, and to are required")
+	}
 	args := []string{"extract", o.Resource, "-n", o.Namespace, "--confirm", fmt.Sprintf("--to=%s", o.To)}
 	_, err := c.executor.Run(args...)
 	return err
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/oc/cli/cli.go` around lines 134 - 137, The Extract method currently
invokes oc without validating required fields, causing unclear downstream CLI
errors; update client.Extract to validate api.ExtractOptions (check o.Resource,
o.Namespace and o.To are non-empty) and return a descriptive error immediately
if any are missing instead of calling c.executor.Run, then proceed to build args
and call c.executor.Run only when all required fields are present.
🤖 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`:
- Around line 119-122: The OC client is created without a Timeout which lets
AdmReleaseInfo use the short 30s default and causes flakiness; update the
oc.NewOC call to pass a longer timeout in ocapi.Options (e.g., set Timeout to a
larger duration) so ocClient := oc.NewOC(ocapi.Options{Logger: logger, Timeout:
<suitable duration>}) ensures AdmReleaseInfo has enough time to complete; modify
the NewOC invocation where oc.NewOC and ocapi.Options are used and keep the rest
of the call to AdmReleaseInfo unchanged.

---

Nitpick comments:
In `@test/oc/cli/cli.go`:
- Around line 134-137: The Extract method currently invokes oc without
validating required fields, causing unclear downstream CLI errors; update
client.Extract to validate api.ExtractOptions (check o.Resource, o.Namespace and
o.To are non-empty) and return a descriptive error immediately if any are
missing instead of calling c.executor.Run, then proceed to build args and call
c.executor.Run only when all required fields are present.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 6c2e1a32-200e-402f-a283-b03789443da7

📥 Commits

Reviewing files that changed from the base of the PR and between a61e6b8 and d9a5d32.

📒 Files selected for processing (4)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json
  • test/cvo/cvo.go
  • test/oc/api/api.go
  • test/oc/cli/cli.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json

@jiajliu
Copy link
Contributor Author

jiajliu commented Mar 16, 2026

Test result on OCP:

$ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_cluster-version-operator/1347/pull-ci-openshift-cluster-version-operator-main-e2e-agnostic-ovn/2032344270085558272/artifacts/e2e-agnostic-ovn/openshift-e2e-test/artifacts/e2e.log|grep "should have correct architecture"
started: 0/199/456 "[Jira:\"Cluster Version Operator\"] cluster-version-operator should have correct architecture info in clusterversion status"
passed: (1.7s) 2026-03-13T08:36:51 "[Jira:\"Cluster Version Operator\"] cluster-version-operator should have correct architecture info in clusterversion status"

Test result on Hypershift:

$ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_cluster-version-operator/1347/pull-ci-openshift-cluster-version-operator-main-e2e-hypershift-conformance/2032344286036496384/artifacts/e2e-hypershift-conformance/conformance-tests/artifacts/e2e.log|grep "should have correct architecture"
started: 0/237/442 "[Jira:\"Cluster Version Operator\"] cluster-version-operator should have correct architecture info in clusterversion status"
passed: (1.6s) 2026-03-13T08:02:26 "[Jira:\"Cluster Version Operator\"] cluster-version-operator should have correct architecture info in clusterversion status"

cc @hongkailiu @DavidHurta to review, thanks

@jiajliu jiajliu changed the title WIP: migrate ocp-53906 from otp to cvo repo NO-JIRA: migrate ocp-53906 from otp to cvo repo Mar 16, 2026
@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 16, 2026
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 16, 2026
@openshift-ci-robot
Copy link
Contributor

@jiajliu: This pull request explicitly references no jira issue.

Details

In response to this:

This PR migrates test case 53906 from openshift-tests-private into cluster-version-operator, which validates CVO correctly parses release architecture into ClusterVersion status. Additionally, it adds the oc helper function AdmReleaseInfo() to support the test.

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.

@jiajliu
Copy link
Contributor Author

jiajliu commented Mar 16, 2026

/retest-required

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 2026

@jiajliu: all tests passed!

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.

2 participants