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

Introduce (pr|nightly)_only markers, split out UI tests that can use scans fixture #523

Merged
merged 3 commits into from
Jul 2, 2024

Conversation

mirekdlugosz
Copy link
Collaborator

Introduce pr_only and nightly_only pytest markers, which allows tests to be marked for execution on PR job or nightly job. Tests not marked with either will be run in both.

With that as a foundation, split out UI end to end test into UI scan test that takes advantage of scans fixture and downloads a scan result created earlier for API/CLI report tests. These new scan tests are marked for PR job execution only. This should speed up PR test execution by few minutes.

UI tests used their own data_provider fixture that cleaned things up before running a test, to work around DISCOVERY-162. Since new scan tests depend on data being kept around, introduce new cleaning_data_provider that does the same thing. All tests using that fixture are moved to the beginning of test run. Changed few other tests running qpc clear --all to use this new fixture, or they would end up removing data that scan UI tests depended on.

Actual filtering out of tests marked with new markers is implemented in discovery-ci PR 85.

@mirekdlugosz mirekdlugosz requested review from a team June 27, 2024 14:59
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.20%. Comparing base (bdb06e0) to head (75ab416).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
+ Coverage   78.13%   78.20%   +0.06%     
==========================================
  Files           7        7              
  Lines         677      679       +2     
==========================================
+ Hits          529      531       +2     
  Misses        148      148              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Builds foundation for DISCOVERY-628.

The idea is that you can mark tests to execute only in PR run or only in
nightly run. Or, consequently, to NOT execute in PR / nightly run. Tests
not marked with either are executed in both pipelines.

The actual implementation of marker-based selection is in discovery-ci.
cleaning_data_provider is module-scoped fixture that runs
data_provider.cleanup() before executing test. This ensures that test
operates on empty database.

UI tests used to have their own data_provider which did exactly that.
However, not all UI tests require clean state - in fact, we want to
introduce UI tests that use shared scan results cache. Also, not only UI
tests can benefit from operating against a clean state.

All tests that use that fixture are executed at the very beginning of
test run. This is done to minimize time spent removing things from
Discovery.
Introduce UI tests that take advantage of cached scans result and
download scans that already exist. They are very similar to existing end
to end tests.

The intent is that new scan tests are going to run only in PR check, to
speed things up. Old end to end tests are going to be run in nightly
pipeline, where execution speed is less of a concern. Since new scan
tests are very much included in old end to end tests, only one of them
should be executed in any given run.
@mirekdlugosz mirekdlugosz merged commit 0840606 into main Jul 2, 2024
9 checks passed
@infinitewarp infinitewarp deleted the use-scans-in-ui branch July 5, 2024 15:19
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