-
Notifications
You must be signed in to change notification settings - Fork 77
confgenerator: use golden package in unit tests #811
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
Conversation
|
Can we add some details (e.g. command output, transcripts, could be a file) for the |
31189b2 to
e0fbaed
Compare
The gotesttools package for golden tests lines up perfectly with the golden tests that we currently do, and using it can greatly simplify our unit test code. This PR reimagines the confgenerator_test.go tests using this package. 2 other minor changes were made: * The invalid type for sqlserver test did not have an input.yaml (this new way of doing tests actually caught that; it's been that way forever) * It never made much sense for `golden_otel` to have an extension of `conf`, this PR switches that to `yaml`
This reverts commit 13b99e9f40387531f6cde67163f7ccaffbceebc3. It did not work.
The local function checkGoldenError was unnecessarily complex compared to simply splitting it up and calling assert in every spot. Thanks @avilevy18 for the suggestion.
Unifies the tests for valid and invalid to reduce repetition. Also supports generating and comparing lua files, as well as cleaning up old ones when the lua files change.
I had a bug in the lua gen testing that botched tons of input.yaml files. I reverted that commit, restored the new confgenerator_test changes, and regenerated the configs. I should be smarter about when I commit!
By using a functional option to runTestsInDir, we can reduce the duplication of gathering all the platform's test cases and asserting differently for valid vs invalid tests.
329db6f to
e3d7607
Compare
|
I'm trying to handle a merge conflict on this PR - I'm wondering why this refactoring added so much duplicate code? The |
|
@quentinmit The unrolling of loops was to add some robustness to the tests. |
Description
The gotesttools package for golden tests lines up perfectly with the
golden tests that we currently do, and using it can greatly simplify our
unit test code. This PR reimagines the confgenerator_test.go tests using
this package. A few other minor changes were made:
new way of doing tests actually caught that; it's been that way
forever)
golden_otelto have an extension ofconf, this PR switches that toyamlgotesttoolsin this PR forgolden, just opted to use theassertpackage as wellRelated issue
None yet, since I wanted to post this as RFC first. 🙂
EDIT: Created a bug for this. b/243791505
How has this been tested?
Verbose test run: https://pastebin.com/SahVB1Kg
The
-updateflag worked as expected, as evidenced by the updated files in the PR.Checklist: