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

chore(tests): do not osExit and return error #2452

Merged
merged 3 commits into from
Apr 4, 2022

Conversation

qdm12
Copy link
Contributor

@qdm12 qdm12 commented Mar 31, 2022

Changes

  • RunGossamer: do not os.Exit and return an error
  • InitializeAndStartNodes return error and teardown nodes on error
  • InitializeAndStartNodesWebsocket return error and teardown nodes on error
  • Fix thread safety on nodes slice in InitializeAndStartNodesWebsocket.

Tests

Issues

Primary Reviewer

  • Anyone, this is trivial

- `RunGossamer`: do not os.Exit and return an error
- `InitializeAndStartNodes` return error and teardown nodes on error
- `InitializeAndStartNodesWebsocket` return error and teardown nodes on error
- Fix thread safety on nodes slice in `InitializeAndStartNodesWebsocket`
@qdm12 qdm12 marked this pull request as ready for review March 31, 2022 10:12
@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #2452 (642f5ba) into development (19a2b4e) will decrease coverage by 0.06%.
The diff coverage is n/a.

@@               Coverage Diff               @@
##           development    #2452      +/-   ##
===============================================
- Coverage        58.54%   58.48%   -0.07%     
===============================================
  Files              214      214              
  Lines            28004    28004              
===============================================
- Hits             16396    16379      -17     
- Misses            9956     9970      +14     
- Partials          1652     1655       +3     
Flag Coverage Δ
unit-tests 58.48% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/blocktree/node.go 65.51% <0.00%> (-6.90%) ⬇️
lib/blocktree/blocktree.go 53.62% <0.00%> (-1.09%) ⬇️
dot/network/light.go 85.25% <0.00%> (-0.80%) ⬇️
dot/network/service.go 56.84% <0.00%> (-0.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e700d5e...642f5ba. Read the comment docs.

tests/utils/gossamer_utils.go Outdated Show resolved Hide resolved
tests/utils/gossamer_utils.go Outdated Show resolved Hide resolved

func InitializeAndStartNodesWebsocket(t *testing.T, num int, genesis, config string) (
nodes []*Node, err error) {
var nodesMutex, errMutex sync.Mutex
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use an errChan or a defined []error of len(num) to get the errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, although there is little point to do this considering the future-to-be changes: this parallel logic is changed to be sequential since it takes a short time to init+start, so only the first error encountered is returned.

@qdm12 qdm12 changed the title chore(e2e): do not os.Exit and return error chore(e2e): do not os.Exit and return error Apr 1, 2022
@qdm12 qdm12 changed the title chore(e2e): do not os.Exit and return error chore(e2e): do not os.Exit and return error Apr 1, 2022
@qdm12 qdm12 changed the title chore(e2e): do not os.Exit and return error chore(e2e): do not osExit and return error Apr 1, 2022
@qdm12 qdm12 changed the title chore(e2e): do not osExit and return error chore(tests): do not osExit and return error Apr 1, 2022
@qdm12 qdm12 requested a review from timwu20 April 1, 2022 15:37
@qdm12 qdm12 merged commit 2deb7dd into development Apr 4, 2022
@qdm12 qdm12 deleted the qdm12/tests-refactor-3 branch April 4, 2022 15:17
rrtti pushed a commit to polkadot-fellows/seeding that referenced this pull request Sep 29, 2022
I am Quentin Mc Gaw, a software engineer working the Go Polkadot host **Gossamer**.
I have been working full time on Gossamer since October 2021, mostly on the state trie and storage.
I have also made a [few minor pull requests](https://github.com/w3f/polkadot-spec/pulls?q=is%3Apr+is%3Aclosed+author%3Aqdm12) to the Polkadot specification repository.

I am requesting to join the Fellowship at rank 1.

## Main contributions

### Gossamer

- Fix memory leaks
  - Trie encoding buffer pools usage fixed [#2009](ChainSafe/gossamer#2009)
  - Fix state map of tries memory leak [#2286](ChainSafe/gossamer#2286)
  - Fix sync benchmark [#2234](ChainSafe/gossamer#2234)
- Trie proof fixes ([#2604](ChainSafe/gossamer#2604), [#2661](ChainSafe/gossamer#2661))
- Fix end to end tests orchestration ([#2470](ChainSafe/gossamer#2470), [#2452](ChainSafe/gossamer#2452), [#2385](ChainSafe/gossamer#2385), [#2370](ChainSafe/gossamer#2370))
- State trie statistics ([#2378](ChainSafe/gossamer#2378), [#2310](ChainSafe/gossamer#2310), [#2272](ChainSafe/gossamer#2272))
- State trie fixes and improvements
  - Only deep copy nodes when mutation is certain [#2352](ChainSafe/gossamer#2352) and [#2223](ChainSafe/gossamer#2223)
  - Only deep copy necessary fields of a node [#2384](ChainSafe/gossamer#2384)
  - Use Merkle values for database keys instead of always hash [#2725](ChainSafe/gossamer#2725)
  - Opportunistic parallel Merkle value commputing [#2081](ChainSafe/gossamer#2081)
- Grandpa capped number of tracked messages ([#2490](ChainSafe/gossamer#2490), [#2485](ChainSafe/gossamer#2485))
- Add pprof HTTP service for profiling [#1991](ChainSafe/gossamer#1991)

Ongoing work:

- State trie lazy loading and caching
- State trie v1 support ([#2736](ChainSafe/gossamer#2736), [#2747](ChainSafe/gossamer#2747), [#2687](ChainSafe/gossamer#2687), [#2686](ChainSafe/gossamer#2686), [#2685](ChainSafe/gossamer#2685), [#2673](ChainSafe/gossamer#2673), [#2611](ChainSafe/gossamer#2611), [#2530](ChainSafe/gossamer#2530))

### Polkadot specification

➡️ [Pull requests from qdm12](https://github.com/w3f/polkadot-spec/pulls?q=is%3Apr+is%3Aclosed+author%3Aqdm12)
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