Skip to content

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

Merged
rboyer merged 2 commits into
masterfrom
shrink-envoy-golden-test-files
Feb 24, 2021
Merged

test: omit envoy golden test files that differ from the latest version#9807
rboyer merged 2 commits into
masterfrom
shrink-envoy-golden-test-files

Conversation

@rboyer
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread agent/xds/golden_test.go
Comment thread agent/xds/golden_test.go Outdated
require.NoError(t, err)

if string(expected) == got {
if *update && got != "" {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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