kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
292 stars 253 forks source link

✨ Add API validation test framework #1919

Closed mdbooth closed 7 months ago

mdbooth commented 7 months ago

This series adds a framework for testing API validations via calls to a running apiserver using envtest. It initially adds only a couple of example tests.

Firstly we update ginkgo to have the same version in tools and the main module, because otherwise it emits a warning.

The we fix an actual bug discovered by the example test: managedSecurityGroups was missing an omitempty, which caused creation of a bare cluster object to fail. We will likely want to visit the minimum set of required parameters, but this was an obvious bug.

Running the tests requires a set of assets to have been downloaded, which the make test target conveniently does for us. However, it wasn't possible to restrict make test to only the tests we are interested in, so we give it an optional TEST_PATHS parameters.

Finally we add a new test suite with 2 trivial tests, enough to demonstrate that it is working correctly.

k8s-ci-robot commented 7 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mdbooth

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](https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/OWNERS)~~ [mdbooth] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
netlify[bot] commented 7 months ago

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

Name Link
Latest commit 4d3e79c8cc23dc4d8bab0f77bec8b44e45e5319e
Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65e5b433a1a5a60008618fbc
Deploy Preview https://deploy-preview-1919--kubernetes-sigs-cluster-api-openstack.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.

mdbooth commented 7 months ago

/cc @JoelSpeed whose CPMS code I cribbed from heavily.

jichenjc commented 7 months ago

/lgtm /hold

add a hold in case anyone want to see this again

mdbooth commented 7 months ago

Interesting that it didn't re-run the tests 🤔

/test all

mdbooth commented 7 months ago

/test pull-cluster-api-provider-openstack-test