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

Revert "Check that scan is running before checking if it finished" #433

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions camayoc/tests/qpc/api/v1/reports/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def test_report_content_consistency(data_provider):
scan = data_provider.scans.new_one({}, new_dependencies=False, data_only=False)
scanjob = ScanJob(scan_id=scan._id)
scanjob.create()
wait_until_state(scanjob, state="running", timeout=120)
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")
report = Report()
response = report.retrieve_from_scan_job(scanjob._id)
if response.json().get("report_id") is None:
Expand Down Expand Up @@ -152,9 +151,8 @@ def test_merge_reports_from_scanjob(data_provider):
scanjob1.create()
scanjob2 = ScanJob(scan_id=scan2._id)
scanjob2.create()
wait_until_state(scanjob1, state="running", timeout=120)
for scanjob in (scanjob1, scanjob2):
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")

report = Report()
report1_json = Report().retrieve_from_scan_job(scanjob1._id).json()
Expand Down Expand Up @@ -259,8 +257,7 @@ def test_products_found_deployment_report(data_provider, scan_info):
scan = data_provider.scans.defined_one({"name": scan_info.get("name")})
scanjob = ScanJob(scan_id=scan._id)
scanjob.create()
wait_until_state(scanjob, state="running", timeout=120)
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")
report = Report()
report.retrieve_from_scan_job(scan_job_id=scanjob._id)
result = SCAN_DATA.get(scan.name)
Expand Down Expand Up @@ -342,8 +339,7 @@ def test_OS_found_deployment_report(data_provider, scan_info: ScanOptions):
scan = data_provider.scans.defined_one({"name": scan_info.name})
scanjob = ScanJob(scan_id=scan._id)
scanjob.create()
wait_until_state(scanjob, state="running", timeout=120)
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")
report = Report()
report.retrieve_from_scan_job(scan_job_id=scanjob._id)
if not report._id:
Expand Down
9 changes: 3 additions & 6 deletions camayoc/tests/qpc/api/v1/scanjobs/test_run_scanjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def test_scan_task_results(data_provider, scan_info: ScanOptions):
scan = data_provider.scans.defined_one({"name": scan_info.name})
scanjob = ScanJob(scan_id=scan._id)
scanjob.create()
wait_until_state(scanjob, state="running", timeout=120)
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")
assertion_error_message = "Details of failed scan : {0}".format(pformat(scanjob.read().json()))

task_results = scanjob.read().json().get("tasks")
Expand Down Expand Up @@ -132,8 +131,7 @@ def test_disabled_optional_products(data_provider):
data_provider.mark_for_cleanup(scan)
scanjob = ScanJob(scan_id=scan._id)
scanjob.create()
wait_until_state(scanjob, state="running", timeout=120)
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")

errors_found = []
# grab disabled products from results
Expand Down Expand Up @@ -185,8 +183,7 @@ def test_enabled_extended_product_search(data_provider):
data_provider.mark_for_cleanup(scan)
scanjob = ScanJob(scan_id=scan._id)
scanjob.create()
wait_until_state(scanjob, state="running", timeout=120)
wait_until_state(scanjob, state="stopped", timeout=900)
wait_until_state(scanjob, state="stopped")

errors_found = []
# grab extended products from config file
Expand Down
3 changes: 1 addition & 2 deletions camayoc/tests/qpc/cli/test_openshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def test_openshift_clusters(cluster, qpc_server_config):
match_scan_id = re.match(r'Scan "(\d+)" started.', output)
assert match_scan_id is not None
scan_job_id = match_scan_id.group(1)
wait_for_scan(scan_job_id, status="running", timeout=120)
wait_for_scan(scan_job_id, status="completed", timeout=1200)
wait_for_scan(scan_job_id, timeout=1200)
result = scan_job({"id": scan_job_id})
assert result["status"] == "completed"
details, deployments = retrieve_report(scan_name, scan_job_id)
Expand Down
3 changes: 1 addition & 2 deletions camayoc/tests/qpc/cli/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ def setup_reports_prerequisites(data_provider):
assert match is not None, result
scan_job_id = match.group(1)
scan["scan-job"] = scan_job_id
wait_for_scan(scan_job_id, status="running", timeout=120)
wait_for_scan(scan_job_id, status="completed")
wait_for_scan(scan_job_id)
result = scan_job({"id": scan_job_id})
assert result["status"] == "completed"
report_id = result["report_id"]
Expand Down
12 changes: 4 additions & 8 deletions camayoc/tests/qpc/cli/test_scanjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def has_single_source(sources_in_scan):
match = re.match(r'Scan "(\d+)" started.', result)
assert match is not None
scan_job_id = match.group(1)
wait_for_scan(scan_job_id, status="running", timeout=120)
wait_for_scan(scan_job_id, status="completed", timeout=1800)
wait_for_scan(scan_job_id, timeout=1800)
result = scan_job({"id": scan_job_id})
assert result["status"] == "completed"
report_id = result["report_id"]
Expand Down Expand Up @@ -108,8 +107,7 @@ def has_two_sources(sources_in_scan):
match = re.match(r'Scan "(\d+)" started.', result)
assert match is not None
scan_job_id = match.group(1)
wait_for_scan(scan_job_id, status="running", timeout=120)
wait_for_scan(scan_job_id, status="completed", timeout=1200)
wait_for_scan(scan_job_id, timeout=1200)
result = scan_job({"id": scan_job_id})
assert result["status"] == "completed"
report_id = result["report_id"]
Expand Down Expand Up @@ -155,8 +153,7 @@ def test_scanjob_with_disabled_products(isolated_filesystem, qpc_server_config,
match = re.match(r'Scan "(\d+)" started.', result)
assert match is not None
scan_job_id = match.group(1)
wait_for_scan(scan_job_id, status="running", timeout=120)
wait_for_scan(scan_job_id, status="completed", timeout=1200)
wait_for_scan(scan_job_id, timeout=1200)
result = scan_job({"id": scan_job_id})
assert result["status"] == "completed"
report_id = result["report_id"]
Expand Down Expand Up @@ -214,8 +211,7 @@ def test_scanjob_with_enabled_extended_products(qpc_server_config, data_provider
match = re.match(r'Scan "(\d+)" started.', result)
assert match is not None
scan_job_id = match.group(1)
wait_for_scan(scan_job_id, status="running", timeout=120)
wait_for_scan(scan_job_id, status="completed", timeout=1200)
wait_for_scan(scan_job_id, timeout=1200)
result = scan_job({"id": scan_job_id})
assert result["status"] == "completed"
report_id = result["report_id"]
Expand Down