Skip to content

Conversation

@hongkailiu
Copy link
Member

Follow up #1309 (comment)

We made an option type for oc cmd.

Currently, it is mostly timeout for running the command. The current implementation use it as the timeout for the context when spawning the process.

The option also gives the flexibility to introduce other options for oc.

/cc @JianLi-RH

@openshift-ci openshift-ci bot requested a review from JianLi-RH February 2, 2026 04:14
@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 Feb 2, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

This change refactors the OC client initialization API to use an Options struct instead of direct parameter passing. A new Options type is introduced containing Logger and Timeout fields. Function signatures for NewOC and NewOCCli are updated to accept Options, with timeout configuration moving from environment variables to the Options.Timeout field with a 30-second default.

Changes

Cohort / File(s) Summary
API Definition
test/oc/api/api.go
Introduces new Options struct with Logger (logr.Logger) and Timeout (time.Duration) fields.
Client Constructors
test/oc/oc.go, test/oc/cli/cli.go
Update NewOC and NewOCCli function signatures to accept api.Options instead of direct logger parameter; timeout configuration moved from environment variable to Options.Timeout with 30s default when zero.
Call Site Update
test/cvo/cvo.go
Updates NewOC call to pass ocapi.Options{Logger: logger} struct instead of bare logger parameter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 2, 2026
@JianLi-RH
Copy link
Contributor

/hold

Let's discuss it together, may be @jhou1 wants to join?

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 2, 2026
@JianLi-RH
Copy link
Contributor

If we add Timeout in the structure function, the timeout setting will be fixed, that means we have to instantiate oc client for each case.

@hongkailiu
Copy link
Member Author

that means we have to instantiate oc client for each case.

I do not see why for each case.

The oc with default timeout (30s). If you do not want to use it because the timeout is too short, you may create a new one for it. There are only a few cases like it, right?

Do you want a timeout for each cmd?
We could do it that way but I do not see the use cases.

@JianLi-RH
Copy link
Contributor

I'd like to put the oc client instantiation scripts into g.BeforeEach(), like kubeClient, err = util.GetKubeClient(restCfg).
So for each test case which uses ocapi.OC will has same timeout setting, for the special case, like 42543 have to create a new ocapi.OC.

@hongkailiu hongkailiu marked this pull request as ready for review February 2, 2026 07:08
@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 Feb 2, 2026
@hongkailiu
Copy link
Member Author

I'd like to put the oc client instantiation scripts into g.BeforeEach()

I am fine with it but that is not really a blocker of this pull, right?
You can do it with a commit in #1309 after this one gets in.
I did not do it here because there is only one case using oc at the moment.
Moving it now inside BeforeEach looks odd to me.

What I did here is only making the API more easier to use: Parameters in an option vs Environment variable.

@hongkailiu hongkailiu changed the title More flexible timeout option for oc-cli NO-JIRA: More flexible timeout option for oc-cli Feb 2, 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 Feb 2, 2026
@openshift-ci-robot
Copy link
Contributor

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

Details

In response to this:

Follow up #1309 (comment)

We made an option type for oc cmd.

Currently, it is mostly timeout for running the command. The current implementation use it as the timeout for the context when spawning the process.

The option also gives the flexibility to introduce other options for oc.

/cc @JianLi-RH

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.

@JianLi-RH
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 2, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongkailiu, JianLi-RH

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

@JianLi-RH
Copy link
Contributor

We need to do more optimize to the timeout setting, but not urgent.

@hongkailiu
Copy link
Member Author

hongkailiu commented Feb 2, 2026

We need to do more optimize to the timeout setting, but not urgent.

For future ourselves, what Jian wants is a setter to change the timeout for an existing oc instance.
For now the use cases are occasionally oc adm release extract needs more time than the default 30s.
However, this might lead to racing for parallel running cases.
We might seek for a solution for this as a future work.

@hongkailiu
Copy link
Member Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 2, 2026
@hongkailiu
Copy link
Member Author

As far as I know, no tests uses the env. vars to configure the timeout.

/verified by @hongkailiu

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Feb 2, 2026
@openshift-ci-robot
Copy link
Contributor

@hongkailiu: This PR has been marked as verified by @hongkailiu.

Details

In response to this:

As far as I know, no tests uses the env. vars to configure the timeout.

/verified by @hongkailiu

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 Feb 2, 2026

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

@openshift-merge-bot openshift-merge-bot bot merged commit 557510e into openshift:main Feb 2, 2026
17 checks passed
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants