WIP: Test: add artifacts #21

Draft
jsheunis wants to merge 3 commits from jsheunis/artifacts into main
2 changed files with 27 additions and 16 deletions

View file

@ -152,3 +152,7 @@ test_script:
touch $HOME/build.lock; touch $HOME/build.lock;
while [ -e $HOME/build.lock ]; do sleep 5; done; while [ -e $HOME/build.lock ]; do sleep 5; done;
fi; fi;
# artifacts:
# - path: /data/archive/study_1/catalog
# name: TestCatalog

View file

@ -154,25 +154,32 @@ def test_pipeline(tmp_path: Path,
with open(metadata_path) as f: with open(metadata_path) as f:
json.load(f) json.load(f)
# 2. Test dataset generation # # 2. Test dataset generation
# - Try to clone the datasets and fetch the dicom tarfile # # - Try to clone the datasets and fetch the dicom tarfile
for study in test_study_names: # for study in test_study_names:
for visit in existing_visits: # for visit in existing_visits:
dataset = clone_visit( # dataset = clone_visit(
tmp_path / f'ds_{study}_{visit}', # tmp_path / f'ds_{study}_{visit}',
data_webserver, # data_webserver,
study, # study,
visit, # visit,
dataaccess_credential, # dataaccess_credential,
credman, # credman,
) # )
# Try to get the tar file and the DICOMs # # Try to get the tar file and the DICOMs
dataset.get(f'icf/{visit}_dicom.tar') # dataset.get(f'icf/{visit}_dicom.tar')
dataset.get(f'{study}_{visit}') # dataset.get(f'{study}_{visit}')
# 3. Test catalog generation # 3. Test catalog generation
# - assert that study catalogs have been created using webcatalog method # - assert that study catalogs have been created using webcatalog method
for study in test_study_names: for i, study in enumerate(test_study_names):
catalog_path = Path(test_studies_dir) / study / 'catalog' catalog_path = Path(test_studies_dir) / study / 'catalog'
ctlg = WebCatalog(location=str(catalog_path)) ctlg = WebCatalog(location=str(catalog_path))
assert ctlg.is_created() assert ctlg.is_created()
if i==0:
runner = WitlessRunner(cwd=test_studies_dir, env=dict(os.environ))
runner.run(
(['sudo', '-E', '--preserve-env=PATH'] if on_appveyor else []) + [
f'appveyor PushArtifact {catalog_path.resolve()}'
]
)