-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
test: omit envoy golden test files that differ from the latest version #9807
Conversation
Since we currently do no version switching this removes 75% of the PR noise. To generate all *.golden files were removed and then I ran: go test ./agent/xds -update
🤔 Double check that this PR does not require a changelog entry in the |
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.
🙏 🙏
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.
This looks great, I like the fact that a lot of mechanical duplication is being removed.
It might be worthwhile to document how the new flow works with .golden files, especially when they need to be recreated, or exceptions managed.
agent/xds/golden_test.go
Outdated
require.NoError(t, err) | ||
|
||
if string(expected) == got { | ||
if *update && got != "" { |
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.
I couldn't figure out what was going on here; the original optional writes the file, then returns the contents, which seems straightforward, and provides a path to regenerate the golden files. But I'm not sure why we delete the golden file, but don't do anything with the newest golden, or why this is guarded by the match with expected.
Perhaps a comment explaining the new workflow, in particular if the version under test isn't the newest.
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.
Yeah I'll add a bunch of comments.
The gist is that when you run the tests with the -update
flag they will erase any golden test files for prior versions that are identical to the golden test file for the latest version of envoy.
During comparison mode, we check for a specific version file if one exists and use that for comparison, but if that does not exist we use the one from the latest version of envoy instead.
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.
@markan check the latest commit in the PR for the restructured function that should hopefully be way clearer.
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/331637. |
Since we currently do no version switching this removes 75% of the PR
noise.
To generate all *.golden files were removed and then I ran:
For quality of life this can be backported to 1.9, 1.8, and 1.7 but they'll all have to be manual.