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

Enable scan tests #412

Merged
merged 9 commits into from
Jun 5, 2023
Merged

Enable scan tests #412

merged 9 commits into from
Jun 5, 2023

Conversation

mirekdlugosz
Copy link
Collaborator

This PR enables reports and scan / scanjobs tests. I tried to make commits relatively complete, so it's best to review things commit-by-commit.

It depends on config changes introduced in discovery-ci PR #7.

Most changes revolve around using DataProvider and untangling dependencies between functions and fixtures. I decided to not port tests that are marked as skipped - I ran them before starting this work, and it seems that referenced issues are still not solved.

Performance of current version is not great, as most tests run scans they need - this leads to servers being scanned multiple times. I think this is something we can try to tackle later on.

Test results are below. There's one failure, but that tests seems flaky - it usually fails, but I saw it passing few times. Another thing to tackle later.

$ pytest -v camayoc/tests/qpc/api/v1/reports/test_reports.py camayoc/tests/qpc/api/v1/scanjobs/ camayoc/tests/qpc/cli/test_reports.py camayoc/tests/qpc/cli/test_scanjobs.py
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_report_content_consistency PASSED                                                                               [  2%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_merge_reports_from_scanjob PASSED                                                                               [  4%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_merge_reports_negative PASSED                                                                                   [  6%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_products_found_deployment_report[testlab] SKIPPED (Skipped until Middleware are handled by Camayoc)             [  8%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_products_found_deployment_report[VCenterOnly] SKIPPED (Skipped until Middleware are handled by Camayoc)         [ 10%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_products_found_deployment_report[Sat6] SKIPPED (Skipped until Middleware are handled by Camayoc)                [ 12%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_OS_found_deployment_report[testlab] PASSED                                                                      [ 14%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_OS_found_deployment_report[VCenterOnly] PASSED                                                                  [ 17%]
camayoc/tests/qpc/api/v1/reports/test_reports.py::test_OS_found_deployment_report[Sat6] PASSED                                                                         [ 19%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_pause_cancel[vcenter] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)    [ 21%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_pause_cancel[network] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)    [ 23%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_pause_cancel[satellite] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)  [ 25%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_pause_cancel[openshift] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)  [ 27%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_restart[vcenter] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)         [ 29%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_restart[network] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)         [ 31%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_restart[satellite] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)       [ 34%]
camayoc/tests/qpc/api/v1/scanjobs/test_pause_cancel_restart.py::test_restart[openshift] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)       [ 36%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_scan_complete[testlab] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)           [ 38%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_scan_complete[VCenterOnly] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)       [ 40%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_scan_complete[Sat6] SKIPPED (Test is flaky. Skipping until Quipucords Issue #2040 resoloved)              [ 42%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_scan_task_results[testlab] PASSED                                                                         [ 44%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_scan_task_results[VCenterOnly] PASSED                                                                     [ 46%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_scan_task_results[Sat6] PASSED                                                                            [ 48%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_disabled_optional_products_facts FAILED                                                                   [ 51%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_disabled_optional_products PASSED                                                                         [ 53%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_enabled_extended_product_search_facts PASSED                                                              [ 55%]
camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py::test_enabled_extended_product_search PASSED                                                                    [ 57%]
camayoc/tests/qpc/cli/test_reports.py::test_deployments_report[csv-report] PASSED                                                                                      [ 59%]
camayoc/tests/qpc/cli/test_reports.py::test_deployments_report[csv-scan-job] PASSED                                                                                    [ 61%]
camayoc/tests/qpc/cli/test_reports.py::test_deployments_report[json-report] PASSED                                                                                     [ 63%]
camayoc/tests/qpc/cli/test_reports.py::test_deployments_report[json-scan-job] PASSED                                                                                   [ 65%]
camayoc/tests/qpc/cli/test_reports.py::test_detail_report[csv-report] PASSED                                                                                           [ 68%]
camayoc/tests/qpc/cli/test_reports.py::test_detail_report[csv-scan-job] PASSED                                                                                         [ 70%]
camayoc/tests/qpc/cli/test_reports.py::test_detail_report[json-report] PASSED                                                                                          [ 72%]
camayoc/tests/qpc/cli/test_reports.py::test_detail_report[json-scan-job] PASSED                                                                                        [ 74%]
camayoc/tests/qpc/cli/test_reports.py::test_merge_report[report] PASSED                                                                                                [ 76%]
camayoc/tests/qpc/cli/test_reports.py::test_merge_report[scan-job] PASSED                                                                                              [ 78%]
camayoc/tests/qpc/cli/test_reports.py::test_merge_report[json-file] PASSED                                                                                             [ 80%]
camayoc/tests/qpc/cli/test_reports.py::test_download_report[report] PASSED                                                                                             [ 82%]
camayoc/tests/qpc/cli/test_reports.py::test_download_report[scan-job] PASSED                                                                                           [ 85%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob PASSED                                                                                                            [ 87%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob_with_multiple_sources PASSED                                                                                      [ 89%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob_with_disabled_products SKIPPED (Skipped until Quipucords Issue #2038 us resolved)                                 [ 91%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob_with_enabled_extended_products PASSED                                                                             [ 93%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob_restart SKIPPED (Skipping until Quipucords Issue #2040 resoloved)                                                 [ 95%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob_cancel PASSED                                                                                                     [ 97%]
camayoc/tests/qpc/cli/test_scanjobs.py::test_scanjob_cancel_paused SKIPPED (Skipping until Quipucords Issue #2040 resoloved)                                           [100%]
====================================================== 1 failed, 29 passed, 17 skipped, 1 warning in 1325.72s (0:22:05) ======================================================

If we have object name, but not id (meaning - it was created through CLI
or UI), and we fail to establish object id, don't try to delete this
object - just assume it's already gone and move on.
It's hard to know exactly when autouse fixture will run. This one is
especially problematic, as it may exit early depending on tests selected
for execution and their order.

Scanjob tests were ported to DataProvider, which can handle their
dependencies. Report tests have their own fixture for scans.
Not only it's hard to know when exactly autouse fixture will run, this
one also goes into DataProvider area of responsibility.
@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Merging #412 (438dd90) into main (bc61228) will decrease coverage by 2.11%.
The diff coverage is 40.00%.

@@            Coverage Diff             @@
##             main     #412      +/-   ##
==========================================
- Coverage   81.22%   79.11%   -2.11%     
==========================================
  Files           5        5              
  Lines         245      249       +4     
==========================================
- Hits          199      197       -2     
- Misses         46       52       +6     
Impacted Files Coverage Δ
camayoc/utils.py 71.87% <14.28%> (-8.78%) ⬇️
camayoc/api.py 69.47% <100.00%> (+0.65%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@ruda ruda left a comment

Choose a reason for hiding this comment

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

This is massive. Did an overall review, seems that everything is sound. LGTM.

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