Skip to content

Conversation

frobware
Copy link

@frobware frobware commented Apr 2, 2019

This a rework of how the unit tests setup the controller and the objects under test. We previously accumulated three ways of setting up the tests - this change reduces that to using just one way, providing uniformity and consistency for all the tests.

The controller functions now return the nodegroup type rather than cloudprovider.<type> to make unit testing easier. The upper layers (i.e., the provider) convert the nodegroup to cloudprovider.NodeGroup. A nodegroup is a cloudprovider.NodeGroup so the overall change here is really small - it only changes the function signature.

Plus various drive-by fixes in the unit tests themselves to:

  • remove unused fields
  • fix-up some nil-pointer analysis highlighted by latest GoLand 2019.1 release
  • increases the existing tests to also test using MachineDeployments where they previously didn't

@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 2, 2019
@frobware
Copy link
Author

frobware commented Apr 2, 2019

As this is still WIP

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 2, 2019
@frobware frobware force-pushed the simplify-controller-unit-tests-v2 branch 6 times, most recently from 076be26 to 6b835aa Compare April 3, 2019 08:50
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 3, 2019
@frobware frobware force-pushed the simplify-controller-unit-tests-v2 branch 4 times, most recently from 346f006 to 5d368ca Compare April 3, 2019 09:52
@frobware
Copy link
Author

frobware commented Apr 3, 2019

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2019
@frobware
Copy link
Author

frobware commented Apr 3, 2019

/refresh

@frobware
Copy link
Author

frobware commented Apr 3, 2019

/retest

@frobware frobware force-pushed the simplify-controller-unit-tests-v2 branch 4 times, most recently from 3bdd54a to ea8237b Compare April 3, 2019 17:59
@frobware
Copy link
Author

frobware commented Apr 3, 2019

@ingvagabund I believe I addressed your issues and observations - and thanks!

@frobware
Copy link
Author

frobware commented Apr 3, 2019

/hold

Holding pending final review and LGTM. At that point I want to squash a lot of these commits.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2019
@ingvagabund
Copy link
Member

LGTM, once squashed as you say I will add real lgtm

@frobware
Copy link
Author

frobware commented Apr 3, 2019

/test images

@frobware
Copy link
Author

frobware commented Apr 3, 2019

/test e2e-aws-operator

frobware added 8 commits April 4, 2019 10:58
Expose the internal type nodegroup at the controller level. This makes
unit testing more feasible. The upper layers (i.e., the provider)
convert to cloudprovider.<types>.
Use "machine.openshift.io/machine" as constant value throughout, not
just in the tests.
Extract the nodegroup.Debug() format string as a const to share
between said function and unit tests.
Shorten the test helper function names that create spec and configs
for the unit tests. They previously had `must` as part of the name but
they don't actually fail and/or return any error.
@frobware frobware force-pushed the simplify-controller-unit-tests-v2 branch from c866ecc to 1a6228b Compare April 4, 2019 09:59
@frobware
Copy link
Author

frobware commented Apr 4, 2019

/refresh

@frobware
Copy link
Author

frobware commented Apr 4, 2019

/test images

@frobware
Copy link
Author

frobware commented Apr 4, 2019

/test e2e-aws-operator

@frobware
Copy link
Author

frobware commented Apr 4, 2019

/retest

@frobware
Copy link
Author

frobware commented Apr 4, 2019

@ingvagabund this has now been rebased as #76 has merged.

@frobware
Copy link
Author

frobware commented Apr 4, 2019

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 4, 2019
@ingvagabund
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2019
@openshift-merge-robot openshift-merge-robot merged commit b38dd11 into openshift:master Apr 4, 2019
@frobware frobware deleted the simplify-controller-unit-tests-v2 branch April 12, 2019 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants