cluster-api-provider-azure icon indicating copy to clipboard operation
cluster-api-provider-azure copied to clipboard

Add unit tests for VM converter

Open willie-yao opened this issue 2 years ago • 6 comments

What type of PR is this? /kind feature

What this PR does / why we need it: This PR adds unit tests for the VM converter

Which issue(s) this PR fixes: Fixes #2538

Special notes for your reviewer:

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

TODOs:

  • [ ] squashed commits
  • [ ] includes documentation
  • [X] adds unit tests

Release note:

NONE

willie-yao avatar Aug 15 '22 17:08 willie-yao

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: willie-yao / name: William Yao (01ac161db732c4c4a1ba70785391dc7295dbcae0)

Welcome @willie-yao!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-azure 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-azure has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Aug 15 '22 17:08 k8s-ci-robot

Hi @willie-yao. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

k8s-ci-robot avatar Aug 15 '22 17:08 k8s-ci-robot

/ok-to-test

mboersma avatar Aug 15 '22 21:08 mboersma

/retest

willie-yao avatar Aug 15 '22 22:08 willie-yao

/retest

willie-yao avatar Aug 18 '22 23:08 willie-yao

By the way since the VM converter never actually returns an error I think could probably just remove it from the function spec. Wdyt about that?

Jont828 avatar Aug 19 '22 23:08 Jont828

I agree with that. Should we do that in a separate PR?

willie-yao avatar Aug 19 '22 23:08 willie-yao

the VM converter never actually returns an error...just remove it from the spec

Should we do that in a separate PR?

My test for that is "is there a possibility we might need to revert these changes separately?" That illuminates whether the changes are logically distinct and ought to have separate commits and PRs.

In this case, the changes are distinct, but I think there's little chance we would need to revert them separately. So IMHO it's a judgment call. It's always defensible to make separate PRs, but I think you could make both changes in one PR in this case and reviewers wouldn't complain...at least I wouldn't. 😄

This lgtm, btw.

mboersma avatar Aug 22 '22 17:08 mboersma

@mboersma @Jont828 Just pushed changes removing the unused err from SDKToVM. Let me know if this looks good, and I'll squash it. I figured I'd include it in this PR since it changes the test somewhat significantly.

willie-yao avatar Aug 22 '22 18:08 willie-yao

Hmm...so changing the signature of SDKToVM is actually a public-facing API change, so apidiff is correct. I think it's entirely likely that no one is consuming that API beyond the single reference that you updated in this PR, but we can't be sure.

Maybe I was wrong about combining the two commits? I'm curious what other reviewers think. ping @Jont828 @CecileRobertMichon @jackfrancis

mboersma avatar Aug 22 '22 20:08 mboersma

@mboersma That's correct. One interesting thing is that my PR to change the apidiff test would have made this test pass, since we are changing that test to only flag breaking changes within the api/ or exp/api/ directories. I'm assuming this means that this change would be okay to merge?

willie-yao avatar Aug 22 '22 20:08 willie-yao

You are correct, I totally forgot that we really only care about those dirs for apidiff. (#2567 can't merge soon enough.)

mboersma avatar Aug 22 '22 20:08 mboersma

@willie-yao if you can rebase this to fix the apidiff error, I think it's good to merge.

mboersma avatar Aug 23 '22 16:08 mboersma

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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:
  • ~~OWNERS~~ [CecileRobertMichon]

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 avatar Aug 23 '22 17:08 k8s-ci-robot