Skip to content

Commit

Permalink
Make import/export tests agnostic to .tar vs .tar.gz
Browse files Browse the repository at this point in the history
re pulpcore/#4446

(cherry picked from commit a0946f2)
  • Loading branch information
dralley committed Sep 26, 2023
1 parent 0a33640 commit 5449e61
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pulp_file/tests/functional/api/from_pulpcore/test_pulpimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ def _find_toc(chunked_export):


def _find_path(created_export):
filenames = [f for f in list(created_export.output_file_info.keys()) if f.endswith("tar.gz")]
filenames = [
f
for f in list(created_export.output_file_info.keys())
if f.endswith("tar") or f.endswith(".tar.gz")
]
return filenames[0]


Expand All @@ -171,13 +175,11 @@ def _perform_import(importer, chunked=False, an_export=None, body=None):
an_export = chunked_export if chunked else created_export

if chunked:
filenames = [f for f in list(an_export.output_file_info.keys()) if f.endswith("json")]
if "toc" not in body:
body["toc"] = filenames[0]
body["toc"] = _find_toc(an_export)
else:
filenames = [f for f in list(an_export.output_file_info.keys()) if f.endswith("tar.gz")]
if "path" not in body:
body["path"] = filenames[0]
body["path"] = _find_path(an_export)

import_response = importers_pulp_imports_api_client.create(importer.pulp_href, body)
task_group = monitor_task_group(import_response.task_group)
Expand Down

0 comments on commit 5449e61

Please sign in to comment.