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

refactor: improve test compilation speed and organization #4027

Merged
merged 2 commits into from
Mar 5, 2021

Conversation

matklad
Copy link
Contributor

@matklad matklad commented Mar 3, 2021

By moving from many integration integration test crates to a single (nested) unit-tests module, we:

  • improve test compilation performance by cutting down on linking time
    significantly
  • improve test run-time by increasing parallelism (20s -> 12s, when
    test_out_of_memory outlier is removed)
  • improve organization by making more things private and making it
    easier to share code between various tests.

See this post for an in-depth explanation:

https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html

When adding a new integration test file, consider an option of putting
it into src dir instead.

By moving from many integration binaries to unit-tests, we:

* improve test compilation performance by cutting down on linking time
  significantly
* improve test run-time by increasing parallelism (20s -> 12s, when
  `test_out_of_memory` outlier is removed)
* improve organization by making more things private and making it
  easier to share code between various tests.

See this post for in-depth explanation:

  https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html

When adding a new integration test file, consider an option of putting
it into `src` dir instead.
@near-bulldozer near-bulldozer bot merged commit a7985e1 into near:master Mar 5, 2021
matklad added a commit to matklad/nearcore that referenced this pull request Apr 29, 2021
See near#4027 for discussion why this layout is better. TL;DR is that we
don't re-link neard repeatedly.

As a cherry on top, we now get to proprely share NodeCluster code
between the tests, instead of it being compiled afresh for each test.
@matklad matklad deleted the test branch April 29, 2021 15:36
matklad added a commit to matklad/nearcore that referenced this pull request Apr 30, 2021
See near#4027 for discussion why this layout is better. TL;DR is that we
don't re-link neard repeatedly.

As a cherry on top, we now get to proprely share NodeCluster code
between the tests, instead of it being compiled afresh for each test.
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