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

Add a pause to fix flaky getstreamex forwarding test. #262

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

clemire
Copy link
Contributor

@clemire clemire commented Jun 24, 2024

I think inserting a short sleep will fix the flaky getstreamex forwarding test, but if it happens again I will disable it.

@clemire clemire requested review from sergekh2 and bas-vk as code owners June 24, 2024 20:56
// quorum will be achieved and the createUser call will return when a node may not have received the miniblock,
// and we could occasionally end up with a stream response that does not contain the genesis miniblock.
// This is why we sleep for a bit before making the stream requests.
time.Sleep(2 * time.Second)
Copy link
Contributor

@sergekh2 sergekh2 Jun 24, 2024

Choose a reason for hiding this comment

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

Adding sleep in test quite often makes flake less probably, but doesn't eliminate it completely. But also it slows down test unnecessarily.

I was under the impression that make_miniblock above should be consistent.

If this is not the case, would using Eventually with a bit larger timeout work out better? https://pkg.go.dev/github.com/stretchr/testify/require#Assertions.Eventually

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's discuss? To make sure I understand the code.

I think the debug make miniblock method will only make a miniblock and commit it to storage on either a single node, but it won't necessarily require the miniblocks to be replicated synchronously to all nodes fora stream. It calls SetStreamLastMiniblock on a node, which emits an event... but there's no guarantee the event will be processed by all nodes for a stream before the call returns. These tests are set up with a replication factor of 5.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thanks for clarifying!

In this case it's better to use require.EventuallyXxx than time.Sleep since Eventually will succeed once the condition is true (after tick delay), so test is going to complete faster. With Sleep test is always going to be slow.

clemire added a commit that referenced this pull request Jun 25, 2024
Testing again #262

---------

Co-authored-by: Crystal Lemire <[email protected]>
@clemire clemire merged commit 78260ae into main Jun 25, 2024
7 of 8 checks passed
@clemire clemire deleted the crystal/fix-forwarder-test branch June 25, 2024 23:13
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.

3 participants