KubernetesTestServer does not return set mocked pods
See original GitHub issueDescribe the bug
We (me and @chris-asl) are using Quarkus and quarkus-kubernetes-client following the documentation Quarkus Kubernetes Client.
The test outlined in the documentation is not passing and fails with
[ERROR] Failures:
[ERROR] KubernetesClientTest.testInteractionWithAPIServer:38 1 expectation failed.
JSON path size() doesn't match.
Expected: is <2>
Actual: <0>
We have created a test repository demonstrating exactly the problem (using code.quarkus.io
) so that we have a minimal, complete and verifiable example, which you can find here.
The project contains three branches:
- master: code as described from the docs
- use-quarkus-snapshot: uses latest Quarkus SNAPSHOT (as outlined in CONTRIBUTING doc), still failling
- fix-with-deprecated-resource: uses a deprecated resource
KubernetesMockServerTestResource
with which the tests are passing
Is there something we’re missing or are the docs outdated?
Expected behavior
Expected Kubernetes Mock Server to return 2 pods.
Actual behavior
Returned 0 pods.
To Reproduce
Here is a project that reproduces the issue (as described above) https://github.com/el10686/quarkus-kubernetes-client
Steps to reproduce the behavior:
- git clone
./mvnw test
Configuration
Empty file
Environment (please complete the following information):
Output of uname -a
or ver
Linux vanias-G5-5500 5.8.0-45-generic #51~20.04.1-Ubuntu SMP Tue Feb 23 13:46:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
GraalVM version (if different from Java)
Not using GraalVM
Quarkus version or git rev
1.12.2.Final and tested against latest snapshot
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/vanias/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.10, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.8.0-45-generic", arch: "amd64", family: "unix"
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (10 by maintainers)
@FroMage @geoand I can confirm this works just fine! Thank you very much for the prompt reply! 😄
#15853 should fix that. Basically CRUD mode is now the default, so if you want to fix your test in the simplest way, just add
crud = false
on the annotation. Or set up your test resources like this:IMO this is cleaner as it doesn’t require mocking HTTP which can be error-prone.