Skip to content

Commit

Permalink
test: fix flaky test (#106)
Browse files Browse the repository at this point in the history
* test: fix flaky test
  • Loading branch information
dinagraves committed Apr 2, 2021
1 parent 95f3200 commit 047b775
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 047b775

Please sign in to comment.