Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS-3753: Allow mocking of the Azure client everywhere #9201

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zaneb
Copy link
Member

@zaneb zaneb commented Nov 13, 2024

Currently the Azure client can only be mocked in unit tests of the pkg/asset/installconfig/azure package. Using the mockable interface consistently and adding a public interface to set it up will allow other packages to write unit tests for code involving the Azure client.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 13, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 13, 2024

@zaneb: This pull request references CORS-3753 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.18.0" version, but no target version was set.

In response to this:

Currently the Azure client can only be mocked in unit tests of the pkg/asset/installconfig/azure package. Using the mockable interface consistently and adding a public interface to set it up will allow other packages to write unit tests for code involving the Azure client.

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.

@zaneb
Copy link
Member Author

zaneb commented Nov 13, 2024

/jira refresh

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 13, 2024

@zaneb: This pull request references CORS-3753 which is a valid jira issue.

In response to this:

/jira refresh

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.

Don't create a new client for each validating each machine type, instead
use the common one that is used to valiate the install-config and cache
it.
@zaneb zaneb force-pushed the azure-client-mock branch 3 times, most recently from 8a07c04 to 930070d Compare November 14, 2024 00:19
Prior to d02d7ee, the
getVirtualNetworksClient() function was private to the client, and only
used by public functions that are part of the API interface. That change
made the function public without making it part of the API interface.

Instead, add a new function to the API interface that does what we want
to do, and return getVirtualNetworksClient() to being an internal
implementation detail.
Add a public function to mock out the Azure client, so that other
packages can do unit testing with a mock client.
Copy link
Contributor

openshift-ci bot commented Nov 14, 2024

@zaneb: 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/okd-scos-e2e-aws-ovn 28fd9a7 link false /test okd-scos-e2e-aws-ovn
ci/prow/e2e-aws-ovn 28fd9a7 link true /test e2e-aws-ovn
ci/prow/e2e-azurestack 28fd9a7 link false /test e2e-azurestack

Full PR test history. Your PR dashboard.

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.

@patrickdillon
Copy link
Contributor

/approve

Copy link
Contributor

openshift-ci bot commented Nov 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: patrickdillon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2024
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants