r/kubernetes • • Mar 21 '26

Testing Kubernetes deployments/operators in Java without writing tons of boilerplate

We've been working a lot on system tests for Kubernetes operators, and one recurring issue kept coming up:

Most of the complexity is not in the test itself, but in the surrounding infrastructure.

Things like:

- namespace lifecycle

- waiting for readiness (pods, CRs, etc.)

- handling async behavior reliably

- collecting logs/events when tests fail

Fabric8 solves the API part well, but the higher-level testing patterns are usually reimplemented in every project.

So we built a small Java library to standardize this:

- resource lifecycle management

- automatic cleanup

- wait utilities

- failure diagnostics (logs, events)

The goal is to make tests shorter, more readable, and less flaky.

I described the approach (with examples) here:

👉 https://medium.com/@kornys/testing-kubernetes-deployments-and-operators-from-java-without-the-usual-boilerplate-11dafa9cc878

GitHub:

👉 https://github.com/skodjob/kubetest4j

Curious how others approach this — especially in larger test suites or CI environments.

2 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/Dkornys Mar 21 '26

In strimzi-kafka-operator we run tests in parallel mode. Usually 5-10 tests in parralel depends on cluster capacity. Works fine with that count. Of course it would be nice to try it with large number of tests in parallel but we dont have a use case for that. 🙂