-
Notifications
You must be signed in to change notification settings - Fork 1.5k
mock: generation is an Integer field #3936
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
mock: generation is an Integer field #3936
Conversation
Hi, I can open an issue to reference if needed. Also, in the template, the CHANGELOG should refer to https://github.com/fabric8io/kubernetes-client/blob/master/CHANGELOG.md, not https://github.com/fabric8io/kubernetes-client/CHANGELOG.md I ran the compilation and found no bug with the existing tests. |
ee1a7e9
to
67ccc66
Compare
I reformated the whole file to follow the code style. The only change in this PR is: metadata.put(GENERATION, getOrDefault(existingMetadata, GENERATION, "1")); to metadata.put(GENERATION, Integer.parseInt(getOrDefault(existingMetadata, GENERATION, "1"))); |
67ccc66
to
610d8b7
Compare
This is very interesting, is your setup available or documented somewhere? We had similar request a while back: #1601 |
Signed-off-by: Marc Nuri <marc@marcnuri.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Kudos, SonarCloud Quality Gate passed! |
Unfortunately, I can't share much info/code as it is done on closed source (I'm not a developer of the kubernetes-c library). Creating the services works fine but when listing them, the parser used in kubernetes-c is strict and did not allow the wrong type so a part of the metadata was not retrieved correctly (and there was some leaks too but that's another issue no the C library). Thank you for the quick integration of the fix! |
Thanks for sharing. This is the part I was interested on, thanks for sharing. So if I understood correctly, basically your testing process runs a separate JVM process with a dummy MockServer and probably prints the HTTP port. The C++ unit test process orchestrates this part, picks up the port, runs the tests, and finally stops the JVM process. If I may, why did you choose to use Fabric8 for this purpose instead of Microcks or other alternatives? |
The port is hardcoded on both sides (using the same KUBERNETES_MASTER env variable), the ip is set to localhost so no need to have a cluster running, but yes, that's the principle.
I'm not the one who did the research on the tool, but I guess we are already using the library so it's the same repo and one less tool to install aside :). And this one was easy to set up and use directly. |
Jut one last question 😅, so you mind if I share this thread publicly? |
I'm not sure by what you mean publicly, but this discussion is already here so yes, you can share what I wrote here :) |
Description
The generation field in the Object Metadata should be an Integer (https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta).
I'm using the Mock to test the api from https://github.com/kubernetes-client/c and it fails to parse the generation field because it is actually a string.
Type of change
test, version modification, documentation, etc.)
Checklist