-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[Go] Verify content of Go server generated files (samples) #19504
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
[Go] Verify content of Go server generated files (samples) #19504
Conversation
|
instead of writing the test in python in the output folder, have you considered adding java unit tests similar to https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/java/org/openapitools/codegen/goginserver/GoGinServerCodegenTest.java ? |
|
Yes, that works but I thought that using Python (or Node) tests allows to better verify the output of the generated code:
After introducing this in the |
|
I don't think go contributors need to learn python/node in order to write tests for the go (client/server) generators (even though python/node is not hard to learn) |
|
I understand your concern, but for example when working on #19550 I find a lot more challenging to create the Java tests, looking at temporary files created (disabling the When verifying the samples (with Python) the generated output is in front of me, and I only have to work/check those files. Why not allowing both approaches? |
My question is more on why not writing these tests in Go instead of Python (or other languages) given that the output that needs to be verified are Go code anyway? I still think writing these tests in Go make other Go contributors life easier as they may not even have Python installed locally in their environment to run the tests. |
|
Ah ok, I see it, I think it is a good idea. I will try it out and update the PR |
|
@wing328 I have replaced the Python tests with Go tests, please have a look |
|
Appreciate the PR to add more tests 👍 |
Update CI pipeline to verify the
go-servergenerated output is correct. Python tests have been created to check the content of the Go files@wing328 Similarly done as for the
postman-collectiongeneratorPR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)