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

Faster unit tests by re-using GPG directory #5683

Merged

Conversation

nabla-c0d3
Copy link
Contributor

@nabla-c0d3 nabla-c0d3 commented Jan 5, 2021

Status

Ready.

Description of Changes

This PR fixes #4331 by updating the config fixture to have it re-use the same GPG directory across all tests via a session scope.

More specifically, the code that imports the test GPG key within the config fixture takes 2s to run on my laptop. This adds a 2s setup call to every single unit test that relies on the config fixture. A lot of tests do use this fixture (directly or indirectly). For example, the first parallel run of app-tests on CircleCI takes 22 minutes to complete for this PR, instead of 28 minutes.

However, this PR is more about improving the developer experience when constantly running a few tests locally, while building a feature. Having a 2s delay on each test makes iterating on a feature much slower.

@nabla-c0d3 nabla-c0d3 changed the title {WIP] Faster unit tests with gpg fixture [WIP] Faster unit tests with gpg fixture Jan 5, 2021
@nabla-c0d3 nabla-c0d3 force-pushed the faster-tests-with-gpg-fixture branch from e1322a8 to b3b80db Compare January 5, 2021 05:34
@nabla-c0d3 nabla-c0d3 changed the title [WIP] Faster unit tests with gpg fixture Faster unit tests by re-using GPG director Jan 5, 2021
@nabla-c0d3 nabla-c0d3 marked this pull request as ready for review January 5, 2021 06:31
@nabla-c0d3 nabla-c0d3 changed the title Faster unit tests by re-using GPG director Faster unit tests by re-using GPG directory Jan 5, 2021
@eloquence eloquence added this to Ready for Review in SecureDrop Team Board Jan 5, 2021
@eloquence
Copy link
Member

@nabla-c0d3 Rebasing should fix the safety check failure (resolved via #5686)

@nabla-c0d3 nabla-c0d3 force-pushed the faster-tests-with-gpg-fixture branch from b3b80db to c2b7a47 Compare January 6, 2021 01:33
@codecov-io
Copy link

codecov-io commented Jan 6, 2021

Codecov Report

Merging #5683 (c2b7a47) into develop (0454478) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5683   +/-   ##
========================================
  Coverage    85.54%   85.54%           
========================================
  Files           52       52           
  Lines         3771     3771           
  Branches       474      474           
========================================
  Hits          3226     3226           
  Misses         440      440           
  Partials       105      105           

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 0454478...c2b7a47. Read the comment docs.

Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

Rest looks good. Thank you @nabla-c0d3 for this. It will surely speedup the tests.

securedrop/tests/conftest.py Outdated Show resolved Hide resolved
securedrop/tests/conftest.py Outdated Show resolved Hide resolved
@nabla-c0d3 nabla-c0d3 force-pushed the faster-tests-with-gpg-fixture branch from c2b7a47 to 50853df Compare January 7, 2021 02:04
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

Looks good. Approved.

@kushaldas kushaldas merged commit 3a4e738 into freedomofpress:develop Jan 11, 2021
SecureDrop Team Board automation moved this from Ready for Review to Done Jan 11, 2021
@nabla-c0d3 nabla-c0d3 deleted the faster-tests-with-gpg-fixture branch February 27, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Initialization of fixures requiring a GPG homedir are slow
4 participants