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

Refactor PowerVSClusterscope function to faciliate UT integration #1827

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

Karthik-K-N
Copy link
Contributor

What this PR does / why we need it:

  1. This PR refactors the code to make use of factory functions which can be used during unit test cases for easy overriding of the function.
  2. Changes are made to PowerVSClient to reuse the session or authenticator if already present in the options passed
  3. Added some sample UT to demonstrate the usage of factory functions

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

Refactor PowerVSClusterscope function to faciliate UT integration

@k8s-ci-robot k8s-ci-robot added area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 4, 2024
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 4, 2024
Copy link

netlify bot commented Jun 4, 2024

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit e8a3e48
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/6683e7a139e2830009a36ad7
😎 Deploy Preview https://deploy-preview-1827--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Karthik-K-N
Copy link
Contributor Author

/hold

testing pending.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 4, 2024
@Karthik-K-N
Copy link
Contributor Author

@mkumatag @Amulyam24 @dharaneeshvrd Please take a look at the approach and let me know your opinion. If you think of any better approach dont forget to comment here.

Copy link
Contributor

@Amulyam24 Amulyam24 left a comment

Choose a reason for hiding this comment

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

Thanks @Karthik-K-N, overall LGTM!

@Karthik-K-N
Copy link
Contributor Author

Karthik-K-N commented Jun 28, 2024

I have verified the workflow with cluster creation and able to see cluster getting created successfully.

karthikkn@Karthiks-MacBook-Pro templates % oc get ibmpowervsmachines
NAME                                         CLUSTER                  AGE     READY   STATE    HEALTH
karthikkn-capi-powervs-control-plane-8mt9p   karthikkn-capi-powervs   30m     true    ACTIVE   OK
karthikkn-capi-powervs-control-plane-hjpzj   karthikkn-capi-powervs   16m     true    ACTIVE   OK
karthikkn-capi-powervs-control-plane-k55d2   karthikkn-capi-powervs   8m36s   true    ACTIVE   WARNING
karthikkn-capi-powervs-md-0-tmx5r-84rnw      karthikkn-capi-powervs   50m     true    ACTIVE   WARNING



karthikkn@Karthiks-MacBook-Pro templates % oc get machines
NAME                                         CLUSTER                  NODENAME                                     PROVIDERID                                                                                         PHASE     AGE     VERSION
karthikkn-capi-powervs-control-plane-8mt9p   karthikkn-capi-powervs   karthikkn-capi-powervs-control-plane-8mt9p   ibmpowervs://osa/osa21/b15f67d5-2f86-4b96-980e-2015dc2bd0de/48a630f7-3eea-4115-ad7d-a1b4491063cb   Running   31m     v1.29.3
karthikkn-capi-powervs-control-plane-hjpzj   karthikkn-capi-powervs   karthikkn-capi-powervs-control-plane-hjpzj   ibmpowervs://osa/osa21/b15f67d5-2f86-4b96-980e-2015dc2bd0de/cb927986-7164-4920-a1cf-9ad04be46ca9   Running   17m     v1.29.3
karthikkn-capi-powervs-control-plane-k55d2   karthikkn-capi-powervs   karthikkn-capi-powervs-control-plane-k55d2   ibmpowervs://osa/osa21/b15f67d5-2f86-4b96-980e-2015dc2bd0de/ae20b96f-6bce-4b4f-bd07-a023f75a095c   Running   9m42s   v1.29.3
karthikkn-capi-powervs-md-0-tmx5r-84rnw      karthikkn-capi-powervs   karthikkn-capi-powervs-md-0-tmx5r-84rnw      ibmpowervs://osa/osa21/b15f67d5-2f86-4b96-980e-2015dc2bd0de/a2402d38-6984-46c4-a3ef-5eede7d2cccb   Running   52m     v1.29.3

@Karthik-K-N
Copy link
Contributor Author

@dharaneeshvrd @mkumatag Please review this PR when you get some time, This will unblock in adding unit test cases.

@dharaneeshvrd
Copy link
Contributor

Changes looks good to me as well!

@Karthik-K-N
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 2, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 2, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 2, 2024
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 2, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Karthik-K-N, mkumatag

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 2, 2024
@k8s-ci-robot k8s-ci-robot merged commit 01e1771 into kubernetes-sigs:main Jul 2, 2024
13 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. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants