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

Add v2 endpoints #325

Closed
wants to merge 4 commits into from
Closed

Add v2 endpoints #325

wants to merge 4 commits into from

Conversation

emerkle826
Copy link
Contributor

@emerkle826 emerkle826 commented Jul 26, 2023

Fixes #326

This PR adds/updates v2 endpoints endpoint (I know) to support new operations to be used by Cassandra Reaper

DO NOT MERGE this until #324 is approved and merge. The rebase this branch off that merge into master

@adejanovski adejanovski marked this pull request as draft July 26, 2023 07:46
@adejanovski
Copy link
Contributor

@emerkle826, I took the liberty of moving this PR to draft mode to make it clear it shouldn't be merged. You can take it out of draft mode when the time comes.

Copy link
Member

@Miles-Garnsey Miles-Garnsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'll need a bit more time on this one. I left a couple of questions :)

One big question here - what sort of tests do we have in play for the API? Do we have any sort of e2e testing right now? Do we need it?

"openAPI": {
"info": {
"version": "0.1",
"version": "0.1.66",
Copy link
Contributor Author

@emerkle826 emerkle826 Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be where the version change to 0.1.67 has to happen (removing the other comment)

@Content(
mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = EndpointStatesResponse.class)))
public Response getEndpointStates() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a Test somewhere

@emerkle826 emerkle826 self-assigned this Jul 26, 2023
@emerkle826 emerkle826 force-pushed the client-gen-v2-endpoints branch 2 times, most recently from 6f3e12e to 17e1eca Compare July 26, 2023 22:03
@Miles-Garnsey
Copy link
Member

From discussions earlier today, if we already have a test framework for the management API, could we please get some e2e tests on this so that all of the new client methods are exercised - once that's done, I think I'll be pretty confident in this PR :)

The other alternative is to check the tests that are added as part of the code gen - @emerkle826 if you are comfortable that those are sufficient we can stick with them. Bearing in mind that this will all be e2e tested in Reaper's tests anyway (but it is still nice to have thorough tests here too...)

@emerkle826
Copy link
Contributor Author

From discussions earlier today, if we already have a test framework for the management API, could we please get some e2e tests on this so that all of the new client methods are exercised

Testing the generated client methods will be difficult with how the generation happens currently. The client source and tests are generated with every compile, but they are not compiled during the compile of the project. Compiling the client requires you to issue another Maven command (i.e. mvn package or mvn install) in the generated project folder, or by providing the generated project's pom.xml location:

mvn install -f ./management-api-server/target/generated-sources/openapi/java-client/pom.xml

from the root of this project.

This is a bit of a chicken-and-egg problem in that generated sources are excluded from git version control (things like build artifacts and stuff that is compiled every time you build). So there is no generated client that is actually checked in to git source control.

The other issue for the generated client is that tests are also generated, but they are practically useless. All of the tests generated are effectively unit tests, and none of them do any validation other than that the client methods can be called, which is really just a validation of the compile-ability of the generated source.

@emerkle826
Copy link
Contributor Author

The other alternative is to check the tests that are added as part of the code gen - @emerkle826 if you are comfortable that those are sufficient we can stick with them.

Unfortunately, they are useless.

@emerkle826
Copy link
Contributor Author

@Miles-Garnsey I've reworked this PR/branch. I've pulled out some of the changes that are not scoped specifically to implementing the v2 endpoints endpoint. I've reverted the configure endpoint changes for now as well.

This PR still should be rebased after PRs #333, #334 and #335 are merged.

@emerkle826
Copy link
Contributor Author

@Miles-Garnsey Gonna shelve this version for now in favor of #343. I will revisit this PR for a refactor week. The current endpoint returns what we need and #343 fixes the annotations so that the generated client has the proper return type.

@emerkle826
Copy link
Contributor Author

Closing this as it will be handled in a refactor week

@emerkle826 emerkle826 closed this Aug 22, 2023
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 this pull request may close these issues.

Provide topology endpoints in OpenAPI client
3 participants