Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

test: fix flaky test #106

Merged
merged 3 commits into from
Apr 2, 2021
Merged
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
5 changes: 3 additions & 2 deletions samples/snippets/samples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_pubsub(self):
# clean up
client.delete_subscription({"subscription": subscription_name})

def test_poll_discovery_occurrence(self):
def test_poll_discovery_occurrence_fails(self):
# try with no discovery occurrence
try:
samples.poll_discovery_finished(self.image_url, 5, PROJECT_ID)
Expand All @@ -197,6 +197,8 @@ def test_poll_discovery_occurrence(self):
# we expect timeout error
assert False

@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_poll_discovery_occurrence(self):
# create discovery occurrence
note_id = 'discovery-note-{}'.format(uuid.uuid4())
client = containeranalysis_v1.ContainerAnalysisClient()
Expand All @@ -220,7 +222,6 @@ def test_poll_discovery_occurrence(self):
create_occurrence(parent=f"projects/{PROJECT_ID}",
occurrence=occurrence)

# poll again
disc = samples.poll_discovery_finished(self.image_url, 10, PROJECT_ID)
status = disc.discovery.analysis_status
assert disc is not None
Expand Down