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 test #23

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Fix flaky test #23

merged 1 commit into from
Nov 10, 2023

Conversation

alex-semenyuk
Copy link
Member

Build is failed time to time due test https://github.com/hyperledger/firefly-tezosconnect/actions/runs/6794181484/job/18470172130

  1. Can reproduce failed behaviour if add additional sleep before done() execution, see test for reproducing the issue and fix for existing
  2. Since we can't identify which one test is failed, added option -v (verbose) it should show passed and failed names of tests.

assert.NotNil(t, res)
}

func TestNewBlockListenerOKNotStopImmediately(t *testing.T) {
Copy link
Member

@denisandreenko denisandreenko Nov 10, 2023

Choose a reason for hiding this comment

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

Thanks for the PR!
Let's call it 'WithDelay' or something like that)

}

res, _, err := c.NewBlockListener(ctx, req)
done()
Copy link
Member

Choose a reason for hiding this comment

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

Let's use 'defer done()' instead (at line 17) to be sure, that it was closed

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually the idea of this fix is moving done here that don't wait additional asserts execution as it was for done for example TestBlockListenerStartGettingHighestBlockRetry. If you compare with the test below the difference is that we just slightly increased time of execution 1 sec + asserts time of execution before done() will be executed and as a result MonitorBlockHeader is executed.
As for point to be sure, that it was closed since this is test and its behaviour should be deterministic so we know that no errors for it then done() should be executed as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

See that the test was failed again so let's remove it - coverage can't be decreased. Let's monitor it with verbose option we should see more details

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2023

Codecov Report

Merging #23 (8132af3) into main (2addcdd) will increase coverage by 1.74%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   46.10%   47.85%   +1.74%     
==========================================
  Files          22       22              
  Lines         861      861              
==========================================
+ Hits          397      412      +15     
+ Misses        459      444      -15     
  Partials        5        5              

see 1 file with indirect coverage changes

Signed-off-by: Alexey Semenyuk <[email protected]>
@denisandreenko denisandreenko merged commit 902dcbb into hyperledger:main Nov 10, 2023
4 checks passed
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