cryostat-operator
cryostat-operator copied to clipboard
Replace fake client with envtest in tests
There are some cases where the fake client doesn't reflect the behaviour of a real API server. This bug contains one example: https://github.com/cryostatio/cryostat-operator/issues/447#issuecomment-1242491587. We already spin up envtest as part of our test suite, we just don't use it. This is closer to a real API server than the fake client represents. We should switch to using it.
The Kubebuilder book has some good examples of testing controllers with envtest: https://book.kubebuilder.io/cronjob-tutorial/writing-tests.html