Skip to content

Commit

Permalink
sync RHOSP repos to capsule
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysawant committed Oct 27, 2023
1 parent 8c87808 commit 6ebe177
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions tests/foreman/api/test_capsulecontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,3 +1353,72 @@ def test_positive_remove_capsule_orphans(
'ls /var/lib/pulp/media/artifact/*/* | xargs file | grep RPM'
)
assert result.status, 'RPM artifacts are still present. They should be gone.'

@pytest.mark.skip_if_not_set('capsule')
def test_positive_capsule_sync_openstack_container_repos(
self,
module_capsule_configured,
function_org,
function_product,
function_lce_library,
):
"""Synchronize openstack container repositories to capsule
:id: 23e64385-7f34-4ab9-bd63-72306e5a4de0
:setup:
1. A blank external capsule that has not been synced yet with immediate download policy.
:steps:
1. Enable openstack container repos and sync it to the Library LCE.
:expectedresults:
1. container repos should sync on capsule.
:customerscenario: true
:BZ: 2154734
"""
capsule_configured = module_capsule_configured
upstream_names = [
'rhosp13/openstack-cinder-api',
'rhosp13/openstack-neutron-server',
'rhosp13/openstack-neutron-dhcp-agent',
'rhosp13/openstack-nova-api',
]
repos = []

for ups_name in upstream_names:
repo = entities.Repository(
content_type='docker',
docker_upstream_name=ups_name,
product=function_product,
url=constants.RH_CONTAINER_REGISTRY_HUB,
upstream_username=settings.subscription.rhn_username,
upstream_password=settings.subscription.rhn_password,
).create()
repo.sync(timeout=1800)
repos.append(repo)

# Associate LCE with the capsule
capsule_configured.nailgun_capsule.content_add_lifecycle_environment(
data={'environment_id': function_lce_library.id}
)
result = capsule_configured.nailgun_capsule.content_lifecycle_environments()
assert len(result['results'])
assert function_lce_library.id in [capsule_lce['id'] for capsule_lce in result['results']]

# Create and publish a content view with all repositories
cv = entities.ContentView(organization=function_org, repository=repos).create()
cv.publish()
cv = cv.read()
assert len(cv.version) == 1

# Promote the latest CV version into capsule's LCE
cvv = cv.version[-1].read()
cvv.promote(data={'environment_ids': function_lce_library.id, 'force': True})
cvv = cvv.read()
assert len(cvv.environment) == 1

capsule_configured.wait_for_sync()

0 comments on commit 6ebe177

Please sign in to comment.