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 flaky behavior for tests using sprig's dateInZone #683

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

hslatman
Copy link
Member

@hslatman hslatman commented Jan 21, 2025

The dateInZone template function would instantiate a new time using time.Now() when a type was provided that it doesn't handle explicitly. This could occasionally result in a mismatch in the time being reported and compared against, usually being the time the test was started.

Also see https://github.com/Masterminds/sprig/blob/8cb06fe3c8b0f1163c26b0a558669da72ee14656/date.go#L25-L48

Fixes #677

The `dateInZone` template function would instantiate a new
time using `time.Now()` when a type was provided that it doesn't
handle explicitly. This could occasionally result in a mismatch in
the time being reported and compared against, usually being the
time the test was started.

Also see https://github.com/Masterminds/sprig/blob/8cb06fe3c8b0f1163c26b0a558669da72ee14656/date.go#L25-L48
@hslatman hslatman linked an issue Jan 21, 2025 that may be closed by this pull request
@hslatman hslatman requested review from a team and maraino January 21, 2025 16:03
@hslatman hslatman merged commit c545845 into master Jan 21, 2025
14 checks passed
@hslatman hslatman deleted the herman/fix-sprig-dateinzone-type branch January 21, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Spurious self-test failures on slow machines
2 participants