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

test: omit envoy golden test files that differ from the latest version #9807

Merged
merged 2 commits into from
Feb 24, 2021

Conversation

rboyer
Copy link
Member

@rboyer rboyer commented Feb 22, 2021

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

For quality of life this can be backported to 1.9, 1.8, and 1.7 but they'll all have to be manual.

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
@rboyer rboyer requested a review from a team February 22, 2021 21:23
@rboyer rboyer self-assigned this Feb 22, 2021
@github-actions github-actions bot added the theme/envoy/xds Related to Envoy support label Feb 22, 2021
@hashicorp-ci
Copy link
Contributor

🤔 Double check that this PR does not require a changelog entry in the .changelog directory. Reference

Copy link
Contributor

@freddygv freddygv left a comment

Choose a reason for hiding this comment

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

🙏 🙏

Copy link
Contributor

@markan markan left a 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 Show resolved Hide resolved
require.NoError(t, err)

if string(expected) == got {
if *update && got != "" {
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@vercel vercel bot temporarily deployed to Preview – consul February 24, 2021 16:16 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 24, 2021 16:16 Inactive
@rboyer rboyer merged commit be89557 into master Feb 24, 2021
@rboyer rboyer deleted the shrink-envoy-golden-test-files branch February 24, 2021 20:04
@hashicorp-ci
Copy link
Contributor

🍒 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.

rboyer added a commit that referenced this pull request Feb 24, 2021
rboyer added a commit that referenced this pull request Feb 24, 2021
rboyer added a commit that referenced this pull request Feb 24, 2021
rboyer added a commit that referenced this pull request Feb 24, 2021
rboyer added a commit that referenced this pull request Feb 24, 2021
rboyer added a commit that referenced this pull request Feb 24, 2021
dizzyup pushed a commit that referenced this pull request Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/envoy/xds Related to Envoy support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants