-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Kubernetes server mock does not load with latest Spring Boot 3.4 Junit Jupiter #6886
Comments
If your tests are relying in JUnit 4 you should either refactor them to JUnit 5 or use the KubernetesMockServer programmatically (I'd strongly advise to update though). Due to a mistake (probably), there's still the KubernetesServer class in the module and should be removed. However, you shouldn't be using it. Is it possible that |
No my tests don't use Junit 4 for a while. And you're right, our tests use KuberneteServer as a mock. I was not aware of this new KubernetesMockServer. |
I just have one issue: this new class does not seem to support the CRUD mode like the other. |
Maybe this is the way?
|
That's one way, the other (and recommended way) is to use the JUnit annotations and inject the client: @EnableKubernetesMockClient
public class YourTest {
KubernetesMockServer server; // Inject the server in case you want to add expectations or verify a request
KubernetesClient client; // Inject the client
} You've got tons of examples here: https://github.com/fabric8io/kubernetes-client/blob/af1555672e86db5e59b670f0977af172f023a9eb/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock |
Perfect, thank you. I think you should update the documentation in the readme, as it's still written with the KubernetesServer class. |
Describe the bug
Regarding the latest Spring Boot 3.4 changes, the Junit
ExternalResource
has been removed from Jupiter dependency, as it is a legacy from Junit 4. (Reference: https://junit.org/junit5/docs/snapshot/user-guide/#migrating-from-junit4-rule-support)This causes this issue when starting the the tests (complete stack trace is below):
Please write a documentation how to avoid this error, and plan to remove the use of ExternalResource if possible.
Thanks a lot.
Fabric8 Kubernetes Client version
7.1.0
Steps to reproduce
Using Mock server with Spring Boot 3.4
Expected behavior
No exception during tests run.
Runtime
other (please specify in additional context)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
Additional context
During Junit tests.
The text was updated successfully, but these errors were encountered: