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

Skip to content

Commit 19573b4

Browse files
chore(test): prevent 'job_with_artifact' fixture running forever
Previously the 'job_with_artifact' fixture could run forever. Now give it up to 60 seconds to complete before failing.
1 parent 553f5b0 commit 19573b4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/functional/cli/test_cli_artifacts.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@
2424

2525
@pytest.fixture(scope="module")
2626
def job_with_artifacts(gitlab_runner, project):
27+
start_time = time.time()
28+
2729
project.files.create(data)
2830

2931
jobs = None
3032
while not jobs:
3133
time.sleep(0.5)
3234
jobs = project.jobs.list(scope="success")
35+
if time.time() - start_time > 60:
36+
print("ERROR: job never succeeded")
37+
for job in project.jobs.list():
38+
job = project.jobs.get(job.id)
39+
job.pprint()
40+
if job.status == "failed":
41+
print()
42+
print("job log/trace:", job.trace())
43+
print()
44+
assert None, "Fixture 'job_with_artifact' failed"
3345

3446
return project.jobs.get(jobs[0].id)
3547

0 commit comments

Comments
 (0)