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(dot/rpc/subscription): Implement WebSocket connection synchronization for testing #3399

Merged
merged 10 commits into from
Jul 25, 2023

Conversation

axaysagathiya
Copy link
Contributor

@axaysagathiya axaysagathiya commented Jul 21, 2023

Changes

inside the setupWSConn function, the httptest.NewServer function starts an HTTP server with a custom handler, but it returns immediately after the server has been started. In some cases, the WebSocket connection might not be fully established by the time the test code reaches at wskt.Wsconn.Close(), resulting in a nil value for wskt.Wsconn, and the test fails.

I have introduced a synchronization mechanism using a channel to ensure the WebSocket connection is fully established before proceeding with the test.

Tests

go test -tags integration github.com/ChainSafe/gossamer

Issues

Closes #2944

Primary Reviewer

@timwu20 @EclesioMeloJunior

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #3399 (694450e) into development (308b10a) will increase coverage by 0.26%.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #3399      +/-   ##
===============================================
+ Coverage        50.98%   51.25%   +0.26%     
===============================================
  Files              231      231              
  Lines            30600    30600              
===============================================
+ Hits             15602    15683      +81     
+ Misses           13337    13258      -79     
+ Partials          1661     1659       -2     

@axaysagathiya axaysagathiya changed the title Fix(dot/rpc/subscription): handle panic in test Fix(dot/rpc/subscription): Implement WebSocket connection synchronization for testing Jul 22, 2023
@axaysagathiya axaysagathiya marked this pull request as draft July 23, 2023 08:04
@axaysagathiya axaysagathiya marked this pull request as ready for review July 24, 2023 12:03
@axaysagathiya axaysagathiya merged commit e75e3ac into ChainSafe:development Jul 25, 2023
22 checks passed
@axaysagathiya axaysagathiya deleted the issue-2944 branch July 25, 2023 16:53
Copy link

🎉 This PR is included in version 0.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

Flaky test in dot/rpc/subscription
3 participants