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

KubernetesMockServer should allow overriding its default /version expectation #3758

Closed
joshiste opened this issue Jan 18, 2022 · 3 comments · Fixed by #4197
Closed

KubernetesMockServer should allow overriding its default /version expectation #3758

joshiste opened this issue Jan 18, 2022 · 3 comments · Fixed by #4197
Assignees
Milestone

Comments

@joshiste
Copy link
Contributor

Is your enhancement related to a problem? Please describe

I want to override the VersionInfo returned by the io.fabric8.kubernetes.client.server.mock.KubernetesServer.

Describe the solution you'd like

Some easy way to specify the version the mock shall return

Describe alternatives you've considered

this.server.expect().get().withPath("/version")
                .andReturn(200, new VersionInfo.Builder().withMajor("1").withMinor("18+").build())
                .always();

This doesn't work for me as the expectation from KubernetesMockServer#onStart() is returned

Additional context

introduced with #3562

@joshiste
Copy link
Contributor Author

Currently using this as workaround:

KubernetesMockServer mock = this.server.getKubernetesMockServer();
mock.clearExpectations();
mock.expect().get().withPath("/").andReturn(200, new RootPathsBuilder().addToPaths(mock.getRootPaths()).build()).always();
mock.expect().get().withPath("/version")
    .andReturn(200, new VersionInfo.Builder().withMajor("1").withMinor("18+").build())
    .always();

@manusa
Copy link
Member

manusa commented Jan 27, 2022

Related to quarkusio/quarkus#23023

@manusa
Copy link
Member

manusa commented Jan 27, 2022

Hi @joshiste
The default version expectation provisioning was added as a feature in #3562 (#3536).

Your approach is the recommended ATM. However, we left the door open for future improvements.

One of the alternatives would be to expose the VersionInfo field:

However, I'm not convinced about this approach.

Feedback is welcome ;)

@manusa manusa changed the title Version of KubernetesMockServer should allow overriding its default /version expectation Apr 27, 2022
@manusa manusa moved this to Planned in Eclipse JKube May 18, 2022
@manusa manusa added this to the 6.0.0 milestone May 18, 2022
@manusa manusa self-assigned this Jun 9, 2022
@manusa manusa moved this from Planned to In Progress in Eclipse JKube Jun 9, 2022
@manusa manusa moved this from In Progress to Review in Eclipse JKube Jun 9, 2022
Repository owner moved this from Review to Done in Eclipse JKube Jun 10, 2022
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

Successfully merging a pull request may close this issue.

2 participants