Skip to content

Commit

Permalink
Stabilize test_scanjob_cancel
Browse files Browse the repository at this point in the history
This test fails every few runs.

Sometimes it fails because job never starts - this is a known problem
with thread-based scan manager, and we can't do anything about this.

Sometimes it fails because we want scanjob to be running, but it
completed already. This seems to only happen for Ansible source. There's
nothing wrong with Ansible itself, but it seems that Ansible in our
environment is relatively small and tends to finish too quick. For now
let's ignore it as a source for this test.
  • Loading branch information
mirekdlugosz committed Sep 12, 2023
1 parent c7b26fa commit 3141b0e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion camayoc/tests/qpc/cli/test_scanjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import re

import pytest
from littletable import Table

from camayoc.constants import QPC_OPTIONAL_PRODUCTS
from camayoc.exceptions import NoMatchingDataDefinitionException
Expand Down Expand Up @@ -284,7 +285,12 @@ def test_scanjob_cancel(qpc_server_config, data_provider):
3) Try to restart the scan by running ``qpc scan restart --id <id>``
:expectedresults: The scan must be canceled and can't not be restarted.
"""
source = data_provider.sources.new_one({}, data_only=False)
# There's nothing fundamentally wrong with Ansible. In our environment,
# it finishes too quick, largely increasing a risk of test failing
# because job finished before we checked if it started.
source = data_provider.sources.new_one(
{"type": Table.not_in(("ansible", "openshift"))}, data_only=False
)
scan_name = uuid4()
scan_add_and_check({"name": scan_name, "sources": source.name})
data_provider.mark_for_cleanup(Scan(name=scan_name))
Expand Down

0 comments on commit 3141b0e

Please sign in to comment.