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

autonat: fix flaky TestAutoNATPrivate #1581

Merged
merged 2 commits into from
Jun 2, 2022
Merged

autonat: fix flaky TestAutoNATPrivate #1581

merged 2 commits into from
Jun 2, 2022

Conversation

MarcoPolo
Copy link
Collaborator

@MarcoPolo MarcoPolo commented May 31, 2022

Fixes #1566 by scaling duration 3/2x. Waits on a channel.

@@ -121,8 +122,8 @@ func TestAutoNATPrivate(t *testing.T) {
connect(t, hs, hc)
require.Eventually(t,
func() bool { return an.Status() == network.ReachabilityPrivate },
2*time.Second,
25*time.Millisecond,
testutils.ScaleDuration(2*time.Second),
Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea why this takes so long? I would've expected 2s to be a long timeout already.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know this doesn't answer your real question (why does this take so long to get to that status). But on my laptop this takes 1 second.

=== RUN   TestAutoNATPrivate
Took: 1.028655875s to see NAT status as private
--- PASS: TestAutoNATPrivate (1.03s)

So it makes sense that CI would fail here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's this second:

// Don't look for peers in the peer store more than once per second.
if !as.lastProbeTry.IsZero() {
backoff := as.lastProbeTry.Add(time.Second)
if backoff.After(nextProbe) {
nextProbe = backoff
}
}
. The first timer fires immediately, but doesn't have any peer ID yet. The second timer fires after one second.

Seems like 20s is way too much on CI. Maybe we can just set to 3s?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's the upper limit, but sure updated :)

@MarcoPolo MarcoPolo changed the base branch from marco/TestSignedPeerRecordWithNoListenAddrs to master June 1, 2022 18:33
@MarcoPolo MarcoPolo linked an issue Jun 1, 2022 that may be closed by this pull request
@marten-seemann marten-seemann merged commit 3517eae into master Jun 2, 2022
MarcoPolo added a commit that referenced this pull request Jun 24, 2022
* Use expectEvent and scale duration for CI

* Use 3 seconds
@MarcoPolo MarcoPolo mentioned this pull request Jul 7, 2022
41 tasks
@ajnavarro ajnavarro mentioned this pull request Aug 24, 2022
72 tasks
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.

autonat: flaky TestAutoNATPrivate
3 participants