stackabletech / issues

This repository is only for issues that concern multiple repositories or don't fit into any specific repository
2 stars 0 forks source link

better unit tests (without kubernetes) #534

Open fhennig opened 8 months ago

fhennig commented 8 months ago

As a Stackable dev I want unit tests so I know stuff works.

nightkr commented 8 months ago

At the end of the day, most of our code is about configuring applications and Kubernetes to do what we want them to. The valuable thing to test there is whether that configuration has the effect that we want. That's inherently not unit testable, and when we try they largely end up being busywork garbage, á la "can we really be sure that 1+1=2?".

nightkr commented 8 months ago

That's not to say that there aren't cases where unit testing can be valuable.. but it's a targeted tool that only really applies where we have non-trivial logic that is independent of the surrounding environment.

fhennig commented 8 months ago

Okay, arguably the ticket is very unspecified haha

I think there is value in having a test for something like this:

I feel like if I had a test like that and also made sure it worked once manually, I'd be confident enough to say that stuff works, without an actual kuttl test. And I think we could run these tests instead to see if things break. At least I feel like a couple kuttl tests basically do this: create some objects. Let operator create other objects. check if objects are there. If it's just that, then we can also do it without kubernetes.

Another example is configOverrides. We want to be sure that they end up in the configMap, and this is a feature that already broke once. But we do not need a kuttl test for this, a test as I described it would be sufficient.