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

bugfix: reduce flakiness in follower node test #5355

Merged
merged 5 commits into from
May 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions node/follower_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package node
import (
"context"
"testing"
"time"

"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
Expand Down Expand Up @@ -206,8 +207,21 @@ func TestSyncRoundWithRemake(t *testing.T) {
}

followNode, _ = remakeableFollowNode(t, tempDir, maxAcctLookback)
status, err := followNode.Status()
require.NoError(t, err)

// Wait for follower to catch up. This rarely is needed, but can happen
// and cause flakey test failures. Timing out can still occur, but is less
// likely than the being caught behind a few rounds.
var status *StatusReport
require.Eventually(t, func() bool {
st, err := followNode.Status()
require.NoError(t, err)
if st.LastRound >= newRound {
status = &st
return true
}
return false
}, 10*time.Second, 500*time.Millisecond, "failed to reach newRound within the allowed time")

require.Equal(t, newRound, status.LastRound)

// syncRound should be at
Expand Down