kubernetes-sigs/cluster-api-provider-vsphere

Use a testenv util package across the code base

Open

#2,124 opened on Jul 31, 2023

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Go (320 forks)auto 404
help wanted

Repository metrics

Stars
 (417 stars)
PR merge metrics
 (PR metrics pending)

Description

In core CAPI at some point we centralized our calls to testenv in the envtest library. This makes testenv setup consistent across the code base and allowed us to implement features like:

  • CAPI_TEST_ENV_KUBECONFIG: if set writes a kubeconfig for testenv to the given path
  • CAPI_TEST_ENV_SKIP_STOP: if set, keep test env running for debugging
  • CAPI_DISABLE_TEST_ENV: if set, doesn't start test env (this is useful for packages which have a mix of regular unit tests and envtest-based unit tests to speed up test execution)
  • ...

CAPV has something like this as well https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/blob/08923bd59012848a01ec55ccbf8d62b40e527ac1/test/helpers/envtest.go#L111 but it is not used across the code base.

The idea of this issue is to take a look at the features the core CAPI testenv package has and implement something similar in CAPV + use it whenever we start a testenv across the entire code base

It could be also an option (maybe in a second iteration) to make the core CAPI envtest package public and re-use it in CAPV. We would have to wait until v1.6 with this though.

Contributor guide