def test_verify_bugzilla_1259248(self): """Create organization with valid manifest. Download debug certificate for that organization and refresh added manifest for few times in a row :id: 1fcd7cd1-8ba1-434f-b9fb-c4e920046eb4 :expectedresults: Scenario passed successfully :CaseLevel: Integration :CaseImportance: Critical """ org = entities.Organization().create() sub = entities.Subscription(organization=org) with manifests.original_manifest() as manifest: upload_manifest(org.id, manifest.content) try: with Session(self) as session: for _ in range(3): self.assertIsNotNone(org.download_debug_certificate()) session.nav.go_to_select_org(org.name) session.nav.go_to_red_hat_subscriptions() self.subscriptions.refresh() self.assertIsNone(session.nav.wait_until_element( common_locators['notif.error'], timeout=5)) self.assertTrue(session.nav.wait_until_element( common_locators['alert.success'], timeout=180)) finally: sub.delete_manifest(data={'organization_id': org.id})
def test_verify_bugzilla_1259248(self): """Create organization with valid manifest. Download debug certificate for that organization and refresh added manifest for few times in a row @feature: Organizations. @assert: Scenario passed successfully """ org = entities.Organization().create() sub = entities.Subscription(organization=org) with manifests.original_manifest() as manifest: upload_manifest(org.id, manifest.content) try: with Session(self.browser) as session: for _ in range(3): self.assertIsNotNone(org.download_debug_certificate()) session.nav.go_to_select_org(org.name) session.nav.go_to_red_hat_subscriptions() self.subscriptions.refresh() self.assertIsNone(session.nav.wait_until_element( common_locators['notif.error'], timeout=5)) self.assertTrue(session.nav.wait_until_element( common_locators['alert.success'], timeout=180)) finally: sub.delete_manifest(data={'organization_id': org.id})
def test_verify_bugzilla_1259248(self): """Create organization with valid manifest. Download debug certificate for that organization and refresh added manifest for few times in a row :id: 1fcd7cd1-8ba1-434f-b9fb-c4e920046eb4 :expectedresults: Scenario passed successfully :CaseLevel: Integration :CaseImportance: Critical """ org = entities.Organization().create() sub = entities.Subscription(organization=org) with manifests.original_manifest() as manifest: upload_manifest(org.id, manifest.content) try: with Session(self.browser) as session: for _ in range(3): self.assertIsNotNone(org.download_debug_certificate()) session.nav.go_to_select_org(org.name) session.nav.go_to_red_hat_subscriptions() self.subscriptions.refresh() self.assertIsNone( session.nav.wait_until_element( common_locators['notif.error'], timeout=5)) self.assertTrue( session.nav.wait_until_element( common_locators['alert.success'], timeout=180)) finally: sub.delete_manifest(data={'organization_id': org.id})
def test_positive_create_after_refresh(self): """Upload a manifest,refresh it and upload a new manifest to an other organization. :id: 1869bbb6-c31b-49a9-bc92-402a90071a11 :customerscenario: true :expectedresults: the manifest is uploaded successfully to other org :BZ: 1393442 :CaseImportance: Critical """ org = entities.Organization().create() org_sub = entities.Subscription(organization=org) new_org = entities.Organization().create() new_org_sub = entities.Subscription(organization=new_org) self.upload_manifest(org.id, manifests.original_manifest()) try: org_sub.refresh_manifest(data={'organization_id': org.id}) self.assertGreater(len(org_sub.search()), 0) self.upload_manifest(new_org.id, manifests.clone()) self.assertGreater(len(new_org_sub.search()), 0) finally: org_sub.delete_manifest(data={'organization_id': org.id})
def test_positive_manifest_refresh(function_org): """upload manifest and refresh :id: 579bbbf7-11cf-4d78-a3b1-16d73bd4ca57 :expectedresults: Manifests can be refreshed :CaseImportance: Critical """ upload_manifest(function_org.id, manifests.original_manifest().content) Subscription.list({'organization-id': function_org.id}, per_page=False) Subscription.refresh_manifest({'organization-id': function_org.id}) Subscription.delete_manifest({'organization-id': function_org.id})
def test_positive_manifest_refresh(self): """upload manifest and refresh :id: 579bbbf7-11cf-4d78-a3b1-16d73bd4ca57 :expectedresults: Manifests can be refreshed :CaseImportance: Critical """ self._upload_manifest(self.org['id'], manifests.original_manifest()) Subscription.list({'organization-id': self.org['id']}, per_page=False) Subscription.refresh_manifest({'organization-id': self.org['id']}) Subscription.delete_manifest({'organization-id': self.org['id']})
def test_positive_refresh(self): """Upload a manifest and refresh it afterwards. @Assert: Manifest is refreshed successfully @Feature: Subscriptions """ org = entities.Organization().create() sub = entities.Subscription(organization=org) with manifests.original_manifest() as manifest: upload_manifest(org.id, manifest.content) try: sub.refresh_manifest(data={'organization_id': org.id}) self.assertGreater(len(sub.search()), 0) finally: sub.delete_manifest(data={'organization_id': org.id})
def test_positive_refresh(request): """Upload a manifest and refresh it afterwards. :id: cd195db6-e81b-42cb-a28d-ec0eb8a53341 :expectedresults: Manifest is refreshed successfully :CaseImportance: Critical """ org = entities.Organization().create() sub = entities.Subscription(organization=org) with manifests.original_manifest() as manifest: upload_manifest(org.id, manifest.content) request.addfinalizer(lambda: sub.delete_manifest(data={'organization_id': org.id})) sub.refresh_manifest(data={'organization_id': org.id}) assert sub.search()
def test_positive_manifest_refresh(self): """upload manifest and refresh @Feature: Subscriptions/Manifest refresh @Assert: Manifests can be refreshed """ self._upload_manifest(self.org['id'], manifests.original_manifest()) Subscription.list( {'organization-id': self.org['id']}, per_page=False, ) Subscription.refresh_manifest({ 'organization-id': self.org['id'], }) Subscription.delete_manifest({ 'organization-id': self.org['id'], })
def test_positive_refresh(self): """Upload a manifest and refresh it afterwards. :id: cd195db6-e81b-42cb-a28d-ec0eb8a53341 :expectedresults: Manifest is refreshed successfully :CaseImportance: Critical """ org = entities.Organization().create() sub = entities.Subscription(organization=org) with manifests.original_manifest() as manifest: upload_manifest(org.id, manifest.content) try: sub.refresh_manifest(data={'organization_id': org.id}) self.assertGreater(len(sub.search()), 0) finally: sub.delete_manifest(data={'organization_id': org.id})
def test_positive_manifest_refresh(self): """upload manifest and refresh @id: 579bbbf7-11cf-4d78-a3b1-16d73bd4ca57 @Assert: Manifests can be refreshed """ self._upload_manifest( self.org['id'], manifests.original_manifest()) Subscription.list( {'organization-id': self.org['id']}, per_page=False, ) Subscription.refresh_manifest({ 'organization-id': self.org['id'], }) Subscription.delete_manifest({ 'organization-id': self.org['id'], })
def test_positive_manifest_refresh(self): """upload manifest and refresh @Feature: Subscriptions/Manifest refresh @Assert: Manifests can be refreshed """ self._upload_manifest( self.org['id'], manifests.original_manifest()) Subscription.list( {'organization-id': self.org['id']}, per_page=False, ) Subscription.refresh_manifest({ 'organization-id': self.org['id'], }) Subscription.delete_manifest({ 'organization-id': self.org['id'], })
def test_positive_manifest_refresh(self): """upload manifest and refresh :id: 579bbbf7-11cf-4d78-a3b1-16d73bd4ca57 :expectedresults: Manifests can be refreshed :CaseImportance: Critical """ self._upload_manifest( self.org['id'], manifests.original_manifest()) Subscription.list( {'organization-id': self.org['id']}, per_page=False, ) Subscription.refresh_manifest({ 'organization-id': self.org['id'], }) Subscription.delete_manifest({ 'organization-id': self.org['id'], })
def test_positive_download_debug_cert_after_refresh(session): """Create organization with valid manifest. Download debug certificate for that organization and refresh added manifest for few times in a row :id: 1fcd7cd1-8ba1-434f-b9fb-c4e920046eb4 :expectedresults: Scenario passed successfully :CaseLevel: Integration :CaseImportance: Critical """ org = entities.Organization().create() try: upload_manifest_locked(org.id, original_manifest()) with session: session.organization.select(org.name) for _ in range(3): assert org.download_debug_certificate() session.subscription.refresh_manifest() finally: entities.Subscription(organization=org).delete_manifest(data={'organization_id': org.id})
def test_positive_rename_satellite(self): """run katello-change-hostname on Satellite server :id: 9944bfb1-1440-4820-ada8-2e219f09c0be :setup: Satellite server with synchronized rh and custom repos and with a registered host :steps: 1. Rename Satellite using katello-change-hostname 2. Do basic checks for hostname change (hostnamctl) 3. Run some existence tests, as in backup testing 4. Verify certificates were properly recreated, check for instances of old hostname in etc/foreman-installer/scenarios.d/ 5. Check for updated repo urls, installation media paths, updated internal capsule 6. Check usability of entities created before rename: refresh manifest, resync repos, republish CVs and re-register hosts 7. Create new entities (run end-to-end test from robottelo) :BZ: 1469466 :expectedresults: Satellite hostname is successfully updated and the server functions correctly :CaseAutomation: automated """ with original_manifest() as manifest: upload_manifest(self.org.id, manifest.content) with get_connection() as connection: old_hostname = connection.run('hostname').stdout[0] new_hostname = 'new-{0}'.format(old_hostname) # create installation medium with hostname in path medium_path = 'http://{0}/testpath-{1}/os/'.format( old_hostname, gen_string('alpha')) medium = entities.Media(organization=[self.org], path_=medium_path).create() repo = entities.Repository(product=self.product, name='testrepo').create() result = connection.run( 'satellite-change-hostname {0} -y -u {1} -p {2}'.format( new_hostname, self.username, self.password), timeout=1200, ) self.assertEqual(result.return_code, 0, 'unsuccessful rename') self.assertIn(BCK_MSG, result.stdout) # services running after rename? result = connection.run('hammer ping') self.assertEqual(result.return_code, 0, 'services did not start properly') # basic hostname check result = connection.run('hostname') self.assertEqual(result.return_code, 0) self.assertIn(new_hostname, result.stdout, 'hostname left unchanged') # check default capsule result = connection.run( 'hammer -u {1} -p {2} --output json capsule \ info --name {0}'.format(new_hostname, self.username, self.password), output_format='json', ) self.assertEqual(result.return_code, 0, 'internal capsule not renamed correctly') self.assertEqual(result.stdout['url'], "https://{}:9090".format(new_hostname)) # check old consumer certs were deleted result = connection.run('rpm -qa | grep ^{}'.format(old_hostname)) self.assertEqual(result.return_code, 1, 'old consumer certificates not removed') # check new consumer certs were created result = connection.run('rpm -qa | grep ^{}'.format(new_hostname)) self.assertEqual(result.return_code, 0, 'new consumer certificates not created') # check if installation media paths were updated result = connection.run( 'hammer -u {1} -p {2} --output json \ medium info --id {0}'.format(medium.id, self.username, self.password), output_format='json', ) self.assertEqual(result.return_code, 0) self.assertIn(new_hostname, result.stdout['path'], 'medium path not updated correctly') # check answer file for instances of old hostname ans_f = '/etc/foreman-installer/scenarios.d/satellite-answers.yaml' result = connection.run('grep " {0}" {1}'.format( old_hostname, ans_f)) self.assertEqual( result.return_code, 1, 'old hostname was not correctly replaced \ in answers.yml', ) # check repository published at path result = connection.run( 'hammer -u {1} -p {2} --output json \ repository info --id {0}'.format( repo.id, self.username, self.password), output_format='json', ) self.assertEqual(result.return_code, 0) self.assertIn( new_hostname, result.stdout['published-at'], 'repository published path not updated correctly', ) # refresh manifest sub = entities.Subscription(organization=self.org) sub.refresh_manifest(data={'organization_id': self.org.id}) # sync and publish the previously created repo repo.sync() cv = entities.ContentView(organization=self.org).create() cv.repository = [repo] cv.update(['repository']) cv.publish()