Skip to content

Fix(dot/rpc/subscription): Implement WebSocket connection synchronization for testing#3399

Merged
axaysagathiya merged 10 commits intoChainSafe:developmentfrom
axaysagathiya:issue-2944
Jul 25, 2023
Merged

Fix(dot/rpc/subscription): Implement WebSocket connection synchronization for testing#3399
axaysagathiya merged 10 commits intoChainSafe:developmentfrom
axaysagathiya:issue-2944

Conversation

@axaysagathiya
Copy link
Copy Markdown
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
Copy Markdown

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
@axaysagathiya axaysagathiya deleted the issue-2944 branch July 25, 2023 16:53
@github-actions
Copy link
Copy Markdown

🎉 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