Commit 9739248a authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Testing CI job artifacts (minimal)

This is a simple roundtrip with a minimum zip file.
Being in a test flagged as suitable for production
servers, it will catch configuration problems such
as config discrepancies between Workhorse and Rails etc.

branch : stable
parent 959880771b74
Pipeline #18058 passed with stages
in 21 minutes and 8 seconds
from io import BytesIO
from zipfile import ZipFile
from .utils import suitable
from .utils.hg import LocalRepo
from .utils.runner import Runner
......@@ -59,7 +62,7 @@ def test_register_grab_job(test_project, tmpdir):
def test_pipeline_pages(test_project, tmpdir):
def test_pipeline_pages_artifacts(test_project, tmpdir):
with Runner.api_register(test_project, 'test_register') as runner:
# push something and grab a job
......@@ -73,6 +76,18 @@ def test_pipeline_pages(test_project, tmpdir):
job = runner.wait_assert_one_job()
zip_path = tmpdir / ''
with ZipFile(zip_path, 'w') as zf:
zf.writestr('report.txt', b'artifact content')
with'rb') as zfobj:
runner.upload_artifact(job, zfobj)
artif_fname, artif_body = test_project.get_job_artifacts(job)
assert artif_fname == ''
with ZipFile(BytesIO(artif_body), 'r') as zf:
with'report.txt') as innerf:
assert == b'artifact content'
# find the pipeline id in job payload
job_vars = {var['key']: var['value'] for var in job['variables']}
pipeline_id = int(job_vars['CI_PIPELINE_ID'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment