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

Fix UpdateTestFiles target #2460

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,17 @@ func porter(args ...string) shx.PreparedCommand {
return p
}

// Update golden test files to match the new test outputs
// Update golden test files (unit tests only) to match the new test outputs and re-run the unit tests
func UpdateTestfiles() {
must.Command("go", "test", "./...").Env("PORTER_UPDATE_TEST_FILES=true").RunV()
must.RunV("make", "test-unit")
os.Setenv("PORTER_UPDATE_TEST_FILES", "true")
defer os.Unsetenv("PORTER_UPDATE_TEST_FILES")

// Run tests and update any golden files
TestUnit()

// Re-run the tests with the golden files locked in to make sure everything passes now
os.Unsetenv("PORTER_UPDATE_TEST_FILES")
TestUnit()
}

// Run all tests known to human-kind
Expand Down