cluster-api-provider-vsphere
cluster-api-provider-vsphere copied to clipboard
Refine context in unit test
/kind bug
What steps did you take and what happened: [A clear and concise description of what the bug is.] Revisit the unit test and setup separate context for different test file or even test case based on specific scenario, instead of using the test-package variable here. We're seeing flaky errors in CI. This helps ensure that test case is kind of isolated and independent from others, which can make predictable and reliable test results.
- Move https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/blob/d420ebd66a1709b899da1c73888ec5e08ba6f0b9/controllers/controllers_suite_test.go#L49 into the
setup()
function and use context.Background in the other functions which did refer this context.
What did you expect to happen:
Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]
Environment:
- Cluster-api-provider-vsphere version:
- Kubernetes version: (use
kubectl version
): - OS (e.g. from
/etc/os-release
):