Refactor existing tests
Why would this not always be true, immediately?
k8sClientreads directly from the Kubernetes API.
Originally posted by @squaremo in https://github.com/weaveworks/tf-controller/pull/1061/files#r1379072182
That's a fully copy paste from a different test and I added extra tests at the end end removed unrelated tests, but mostly kept as it is, and that's why I said a few months ago to not address it per test, but create a follow-up issue, refractor tests, otherwise we will end up with the same problems if anyone tries to create a new test case as everyone will start their new test case by finding one that "kind of tests" the same thing, and change it to fulfil the needs of the test case.
Originally posted by @yitsushi in https://github.com/weaveworks/tf-controller/pull/1061#discussion_r1382653759
Scope:
- Remove unnecessary parts: there are some block that tests nothing really, just a leftover from a previous copy-paste.
-
Investigate and potentially refactor checks depending on exact value. For example there are checks to verify there is only one status condition, but in reality it should check:
- it has at least 1 entry
- it has a specific entry
Have you considered refactor some tests to be using https://github.com/kyverno/chainsaw ? I have used it for some controllers and it creates really readable and easy to maintain e2e tests. However, it can be difficult to use if you require to mock out certain parts of the code.
would love to try it. maybe you could introduce it to this project by porting just one simple e2e case and we would evaluate them together.
I could do that!