Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better unit tests (without kubernetes) #534

Open
Tracked by #533
fhennig opened this issue Feb 26, 2024 · 3 comments
Open
Tracked by #533

better unit tests (without kubernetes) #534

fhennig opened this issue Feb 26, 2024 · 3 comments

Comments

@fhennig
Copy link
Member

fhennig commented Feb 26, 2024

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

@nightkr
Copy link
Member

nightkr commented Feb 29, 2024

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
Copy link
Member

nightkr commented Feb 29, 2024

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
Copy link
Member Author

fhennig commented Mar 4, 2024

Okay, arguably the ticket is very unspecified haha

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

  • There is a CA in a SecretClass that is referenced in an Auth class that is referenced in Trino.
  • Given all these objects, is the correct VolumeMount created in the right place, and the right setting set in the ConfigMap?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants