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

scrypto: Fix flaky tests #3022

Merged
merged 2 commits into from
Aug 22, 2019
Merged

scrypto: Fix flaky tests #3022

merged 2 commits into from
Aug 22, 2019

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Aug 21, 2019

Always provide the not_before time of the validity period to avoid
flaky tests at second boundaries.

fixes #2993


This change is Reviewable

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

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

Reviewed 13 of 13 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)


go/lib/scrypto/cert/v2/base_test.go, line 85 at r1 (raw file):

func newBaseCert(notBefore time.Time) cert.Base {
	now := notBefore.Round(time.Second)

Maybe -1 so that if you have tests that do checks with the not before and now they will actually work as expected (Round rounds up so Now() could suddenly be before not_before which is a bit counter intuitive) That comment applies to all locations you do this.

Always provide the not_before time of the validity period to avoid
flaky tests at second boundaries.

fixes scionproto#2993
Copy link
Contributor Author

@oncilla oncilla left a comment

Choose a reason for hiding this comment

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

Reviewable status: 11 of 13 files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker)


go/lib/scrypto/cert/v2/base_test.go, line 85 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Maybe -1 so that if you have tests that do checks with the not before and now they will actually work as expected (Round rounds up so Now() could suddenly be before not_before which is a bit counter intuitive) That comment applies to all locations you do this.

Ah yeah, it rounds to the nearest multiple of d.
Replaced with Truncate which always rounds down.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@oncilla oncilla merged commit fa2dc7a into scionproto:master Aug 22, 2019
@oncilla oncilla deleted the pub-flake branch August 22, 2019 06:48
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.

scrypto: Cert unit test is racy
2 participants