Skip to content

Commit

Permalink
Add a case to export/import entities with long names (#14438)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik authored Mar 19, 2024
1 parent 222a69e commit dd5de39
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions tests/foreman/cli/test_satellitesync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,106 @@ def test_positive_export_incremental_syncable_check_content(
f'{repomd_refs - drive_files}'
)

@pytest.mark.tier3
def test_postive_export_import_with_long_name(
self,
target_sat,
config_export_import_settings,
export_import_cleanup_module,
module_org,
function_import_org,
):
"""Export and import content entities (product, repository, CV) with a long name.
:id: 66d676ab-4e06-446b-b893-e236b26d37d9
:steps:
1. Create product and repository with a long name, sync it.
2. Export the repository, import it and verify the prod and repo names match the export.
3. Verify the imported content matches the export.
4. Create CV with a long name, add the repo and publish.
5. Export the CV, import it and verify its name matches the export.
6. Verify the imported content matches the export.
:expectedresults:
1. Exports and imports should succeed without any errors and names
and content of imported entities should match the export.
:BZ: 2124275, 2053329
:customerscenario: true
"""
# Create product and repository with a long name, sync it.
product = target_sat.cli_factory.make_product(
{'name': gen_string('alpha', 128), 'organization-id': module_org.id}
)
repo = target_sat.cli_factory.make_repository(
{
'name': gen_string('alpha', 128),
'content-type': 'yum',
'download-policy': 'immediate',
'organization-id': module_org.id,
'product-id': product.id,
}
)
target_sat.cli.Repository.synchronize({'id': repo.id})
exported_packages = target_sat.cli.Package.list({'repository-id': repo.id})

# Export the repository, import it and verify the prod and repo names match the export.
export = target_sat.cli.ContentExport.completeRepository(
{'id': repo.id, 'organization-id': module_org.id}
)
import_path = target_sat.move_pulp_archive(module_org, export['message'])
target_sat.cli.ContentImport.repository(
{'organization-id': function_import_org.id, 'path': import_path}
)
import_repo = target_sat.cli.Repository.info(
{
'organization-id': function_import_org.id,
'name': repo.name,
'product': product.name,
}
)

# Verify the imported content matches the export.
imported_packages = target_sat.cli.Package.list({'repository-id': import_repo['id']})
assert imported_packages == exported_packages, 'Imported content does not match the export'

# Create CV with a long name, add the repo and publish.
exporting_cv = target_sat.cli_factory.make_content_view(
{'name': gen_string('alpha', 128), 'organization-id': module_org.id}
)
target_sat.cli.ContentView.add_repository(
{
'id': exporting_cv.id,
'organization-id': module_org.id,
'repository-id': repo.id,
}
)
target_sat.cli.ContentView.publish({'id': exporting_cv['id']})
exporting_cv = target_sat.cli.ContentView.info({'id': exporting_cv['id']})
assert len(exporting_cv['versions']) == 1
exporting_cvv_id = exporting_cv['versions'][0]['id']

# Export the CV, import it and verify its name matches the export.
export = target_sat.cli.ContentExport.completeVersion(
{'id': exporting_cvv_id, 'organization-id': module_org.id}
)
import_path = target_sat.move_pulp_archive(module_org, export['message'])
target_sat.cli.ContentImport.version(
{'organization-id': function_import_org.id, 'path': import_path}
)
importing_cv = target_sat.cli.ContentView.info(
{'name': exporting_cv['name'], 'organization-id': function_import_org.id}
)
assert len(importing_cv['versions']) == 1

# Verify the imported content matches the export.
imported_packages = target_sat.cli.Package.list(
{'content-view-version-id': importing_cv['versions'][0]['id']}
)
assert exported_packages == imported_packages


class TestInterSatelliteSync:
"""Implements InterSatellite Sync tests in CLI"""
Expand Down

0 comments on commit dd5de39

Please sign in to comment.