Skip to content

Commit

Permalink
sync RHOSP repos to capsule (#12990)
Browse files Browse the repository at this point in the history
(cherry picked from commit ad95132)
  • Loading branch information
vijaysawant authored and web-flow committed Oct 31, 2023
1 parent cb0e2c9 commit 2ed9188
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 @@ -1355,3 +1355,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_target_sat,
module_capsule_configured,
function_org,
function_product,
function_lce,
):
"""Synchronize openstack container repositories to capsule
:id: 23e64385-7f34-4ab9-bd63-72306e5a4de0
:setup:
1. A blank external capsule that has not been synced yet.
:steps:
1. Enable and sync openstack container repos.
:expectedresults:
1. container repos should sync on capsule.
:customerscenario: true
:BZ: 2154734
"""
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 = module_target_sat.api.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
module_capsule_configured.nailgun_capsule.content_add_lifecycle_environment(
data={'environment_id': function_lce.id}
)
result = module_capsule_configured.nailgun_capsule.content_lifecycle_environments()
assert len(result['results'])
assert function_lce.id in [capsule_lce['id'] for capsule_lce in result['results']]

# Create and publish a content view with all repositories
cv = module_target_sat.api.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.id})
cvv = cvv.read()
assert len(cvv.environment) == 2

module_capsule_configured.wait_for_sync()

0 comments on commit 2ed9188

Please sign in to comment.