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

Ensure we still rerun tests when there are warnings #235

Merged
merged 2 commits into from
Mar 30, 2022

Conversation

ashanbrown
Copy link
Contributor

@ashanbrown ashanbrown commented Feb 25, 2022

Proposal for skipping over warnings.

Elapsed times in golden files are causing this to fail. It's also a pretty heavy-weight test for such a small change so maybe we should test this some other way.

Fixes #232

@ashanbrown ashanbrown marked this pull request as draft February 25, 2022 18:41
@ashanbrown ashanbrown marked this pull request as ready for review March 15, 2022 17:23
@dnephin
Copy link
Member

dnephin commented Mar 25, 2022

Thanks for working on this fix! Sorry it's taken me a bit of time to review.

I think what you have looks like a reasonable way to solve the problem. I'll take a closer look and try to fix the test failure in the next few days.

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@dnephin
Copy link
Member

dnephin commented Mar 30, 2022

I think the test failures are because the GOTESTSUM_FORMAT env var is set in CI, so the output of the test is different. I've updated the test to set a --format, and updated the golden file as well.

@dnephin dnephin force-pushed the asb/ignore-warnings branch from 512bb97 to 283d44e Compare March 30, 2022 00:12
ashanbrown and others added 2 commits March 29, 2022 20:15
Use an explicit format so that the env var set in CI doesn't change the output
And update the golden file to match.
Comment on lines 38 to 41
var trailingElapsedTimePattern = regexp.MustCompile(`\s*\(\d+(\.\d+)?m?s\)\s*$`)

func OpRemoveTestElapsedTime(line string) string {
if i := strings.Index(line, " (0."); i > 0 && i+8 == len(line) {
return line[:i]
}
return line
return trailingElapsedTimePattern.ReplaceAllString(line, "")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think I see why this change was made. I generally try to avoid regex. Reverting this still has the tests passing.

I'm going to revert this part of the change for now. We can always re-introduce it later if it fixed something that I'm missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The time was being reported in ms rather than seconds so it didn't start with 0. Sounds like changing GOTESTSUM_FORMAT will fix that.

@dnephin dnephin force-pushed the asb/ignore-warnings branch from 283d44e to bba51ac Compare March 30, 2022 00:16
@dnephin dnephin merged commit 528a3fd into gotestyourself:main Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

possible bug: build errors passes except when rerun is required
2 participants