cryostat-operator icon indicating copy to clipboard operation
cryostat-operator copied to clipboard

Replace fake client with envtest in tests

Open ebaron opened this issue 2 years ago • 1 comments

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.

ebaron avatar Sep 09 '22 21:09 ebaron

The Kubebuilder book has some good examples of testing controllers with envtest: https://book.kubebuilder.io/cronjob-tutorial/writing-tests.html

ebaron avatar Oct 07 '22 16:10 ebaron