def test_promote_multiple_docker_repo_content_view(self): """@Test: Add Docker-type repository to content view and publish it. Then promote it to multiple available lifecycle-environments. @Assert: Docker-type repository is promoted to content view found in the specific lifecycle-environments. @Feature: Docker """ self._create_and_associate_repo_with_cv() ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id']}) self.assertEqual(len(self.content_view['versions']), 1) cvv = ContentView.version_info({ 'id': self.content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), 1) for i in range(1, randint(3, 6)): lce = make_lifecycle_environment({'organization-id': self.org_id}) ContentView.version_promote({ 'id': cvv['id'], 'lifecycle-environment-id': lce['id'], }) cvv = ContentView.version_info({ 'id': self.content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), i+1)
def test_positive_update_aks_to_chost(self): """Check if multiple Activation keys can be attached to a Content host @Feature: Activation key - Content host @Assert: Multiple Activation keys are attached to a Content host """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_aks = [ make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) for _ in range(2) ] with VirtualMachine(distro='rhel65') as vm: vm.install_katello_ca() for i in range(2): result = vm.register_contenthost( new_aks[i]['name'], self.org['label']) self.assertEqual(result.return_code, 0)
def test_positive_update_lce(self): """Update Environment in an Activation key :id: 55aaee60-b8c8-49f0-995a-6c526b9b653b :expectedresults: Activation key is updated :CaseLevel: Integration """ ak_env = self._make_activation_key({ u'lifecycle-environment-id': self.get_default_env()['id'], }) env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) ActivationKey.update({ u'id': ak_env['id'], u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) updated_ak = ActivationKey.info({'id': ak_env['id']}) self.assertEqual(updated_ak['lifecycle-environment'], env['name'])
def setup_content_view(self, org_id, lce_id=None): # type: (int, int) -> Tuple[Dict, Dict] """Setup organization content view by adding all the repositories, publishing and promoting to lce if needed. """ if lce_id is None: lce = make_lifecycle_environment({'organization-id': org_id}) else: lce = LifecycleEnvironment.info({ 'id': lce_id, 'organization-id': org_id, }) content_view = make_content_view({'organization-id': org_id}) # Add repositories to content view for repo in self: repo.add_to_content_view(org_id, content_view['id']) # Publish the content view ContentView.publish({'id': content_view['id']}) if lce['name'] != ENVIRONMENT: # Get the latest content view version id content_view_version = ContentView.info({'id': content_view['id'] })['versions'][-1] # Promote content view version to lifecycle environment ContentView.version_promote({ 'id': content_view_version['id'], 'organization-id': org_id, 'to-lifecycle-environment-id': lce['id'], }) content_view = ContentView.info({'id': content_view['id']}) return content_view, lce
def test_positive_update_aks_to_chost(self): """Check if multiple Activation keys can be attached to a Content host :id: 24fddd9c-03ae-41a7-8649-72296cbbafdf :expectedresults: Multiple Activation keys are attached to a Content host :CaseLevel: System """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_aks = [ make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) for _ in range(2) ] with VirtualMachine(distro=DISTRO_RHEL6) as vm: vm.install_katello_ca() for i in range(2): vm.register_contenthost( self.org['label'], new_aks[i]['name']) self.assertTrue(vm.subscribed)
def test_positive_update_lce(self): """Update Environment in an Activation key @Feature: Activation key - Positive Update @Assert: Activation key is updated """ ak_env = self._make_activation_key({ u'lifecycle-environment-id': self.get_default_env()['id'], }) env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) ActivationKey.update({ u'id': ak_env['id'], u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) updated_ak = ActivationKey.info({'id': ak_env['id']}) self.assertEqual(updated_ak['lifecycle-environment'], env['name'])
def test_positive_sync_publish_promote_cv(self): """Synchronize repository with DRPMs, add repository to content view, publish and promote content view to lifecycle environment @id: a01cb12b-d388-4902-8532-714f4e28ec56 @Assert: drpms can be listed in content view in proper lifecycle environment """ lce = make_lifecycle_environment({"organization-id": self.org["id"]}) repo = make_repository({"product-id": self.product["id"], "url": FAKE_YUM_DRPM_REPO}) Repository.synchronize({"id": repo["id"]}) cv = make_content_view({"organization-id": self.org["id"]}) ContentView.add_repository({"id": cv["id"], "repository-id": repo["id"]}) ContentView.publish({"id": cv["id"]}) content_view = ContentView.info({"id": cv["id"]}) cvv = content_view["versions"][0] ContentView.version_promote({"id": cvv["id"], "to-lifecycle-environment-id": lce["id"]}) result = ssh.command( "ls /var/lib/pulp/published/yum/https/repos/{}/{}/{}/custom/{}/{}" "/drpms/ | grep .drpm".format( self.org["label"], lce["label"], cv["label"], self.product["label"], repo["label"] ) ) self.assertEqual(result.return_code, 0) self.assertGreaterEqual(len(result.stdout), 1)
def test_positive_update_aks_to_chost(self): """@Test: Check if multiple Activation keys can be attached to a Content host @Feature: Activation key - Content host @Assert: Multiple Activation keys are attached to a Content host """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_aks = [ make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) for _ in range(2) ] with VirtualMachine(distro='rhel65') as vm: vm.install_katello_ca() for i in range(2): result = vm.register_contenthost( new_aks[i]['name'], self.org['label']) self.assertEqual(result.return_code, 0)
def setUpClass(cls): """Create necessary objects which can be re-used in tests.""" super(DockerActivationKeyTestCase, cls).setUpClass() cls.org = make_org() cls.lce = make_lifecycle_environment({ 'organization-id': cls.org['id'], }) cls.product = make_product({ 'organization-id': cls.org['id'], }) cls.repo = _make_docker_repo(cls.product['id']) cls.content_view = make_content_view({ 'composite': False, 'organization-id': cls.org['id'], }) ContentView.add_repository({ 'id': cls.content_view['id'], 'repository-id': cls.repo['id'], }) cls.content_view = ContentView.info({ 'id': cls.content_view['id'] }) ContentView.publish({'id': cls.content_view['id']}) cls.content_view = ContentView.info({ 'id': cls.content_view['id']}) cls.cvv = ContentView.version_info({ 'id': cls.content_view['versions'][0]['id'], }) ContentView.version_promote({ 'id': cls.content_view['versions'][0]['id'], 'lifecycle-environment-id': cls.lce['id'], }) cls.cvv = ContentView.version_info({ 'id': cls.content_view['versions'][0]['id'], })
def test_positive_update_lce(self): """@Test: Update Environment in an Activation key @Feature: Activation key - Positive Update @Assert: Activation key is updated """ ak_env = self._make_activation_key({ u'lifecycle-environment-id': self.get_default_env()['id'], }) env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) ActivationKey.update({ u'id': ak_env['id'], u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) updated_ak = ActivationKey.info({'id': ak_env['id']}) self.assertEqual(updated_ak['lifecycle-environment'], env['name'])
def setup_content(request): """Pytest fixture for setting up an organization, manifest, content-view, lifecycle environment, and activation key with subscriptions""" org = make_org() with manifests.clone() as manifest: upload_file(manifest.content, manifest.filename) new_product = make_product({'organization-id': org['id']}) new_repo = make_repository({'product-id': new_product['id']}) Repository.synchronize({'id': new_repo['id']}) content_view = make_content_view({'organization-id': org['id']}) ContentView.add_repository( {'id': content_view['id'], 'organization-id': org['id'], 'repository-id': new_repo['id']} ) ContentView.publish({'id': content_view['id']}) env = make_lifecycle_environment({'organization-id': org['id']}) cvv = ContentView.info({'id': content_view['id']})['versions'][0] ContentView.version_promote({'id': cvv['id'], 'to-lifecycle-environment-id': env['id']}) new_ak = make_activation_key( { 'lifecycle-environment-id': env['id'], 'content-view': content_view['name'], 'organization-id': org['id'], 'auto-attach': False, } ) subs_id = Subscription.list({'organization-id': org['id']}, per_page=False) ActivationKey.add_subscription({'id': new_ak['id'], 'subscription-id': subs_id[0]['id']}) request.cls.setup_org = org request.cls.setup_new_ak = new_ak request.cls.setup_subs_id = subs_id request.cls.setup_env = env request.cls.setup_content_view = content_view
def setup_content_view(self, org_id, lce_id=None): # type: (int, int) -> Tuple[Dict, Dict] """Setup organization content view by adding all the repositories, publishing and promoting to lce if needed. """ if lce_id is None: lce = make_lifecycle_environment({'organization-id': org_id}) else: lce = LifecycleEnvironment.info({ 'id': lce_id, 'organization-id': org_id, }) content_view = make_content_view({'organization-id': org_id}) # Add repositories to content view for repo in self: repo.add_to_content_view(org_id, content_view['id']) # Publish the content view ContentView.publish({'id': content_view['id']}) if lce['name'] != ENVIRONMENT: # Get the latest content view version id content_view_version = ContentView.info({ 'id': content_view['id'] })['versions'][-1] # Promote content view version to lifecycle environment ContentView.version_promote({ 'id': content_view_version['id'], 'organization-id': org_id, 'to-lifecycle-environment-id': lce['id'], }) content_view = ContentView.info({'id': content_view['id']}) return content_view, lce
def setUp(self): """Tests for Host Collections via Hammer CLI""" super(HostCollectionTestCase, self).setUp() if HostCollectionTestCase.org is None: HostCollectionTestCase.org = make_org(cached=True) if HostCollectionTestCase.new_lifecycle is None: HostCollectionTestCase.new_lifecycle = make_lifecycle_environment( {u"organization-id": HostCollectionTestCase.org["id"]}, cached=True ) if HostCollectionTestCase.library is None: HostCollectionTestCase.library = LifecycleEnvironment.info( {u"organization-id": HostCollectionTestCase.org["id"], u"name": ENVIRONMENT} ) if HostCollectionTestCase.default_cv is None: HostCollectionTestCase.default_cv = ContentView.info( {u"organization-id": HostCollectionTestCase.org["id"], u"name": DEFAULT_CV} ) if HostCollectionTestCase.new_cv is None: HostCollectionTestCase.new_cv = make_content_view({u"organization-id": HostCollectionTestCase.org["id"]}) HostCollectionTestCase.promoted_cv = None cv_id = HostCollectionTestCase.new_cv["id"] ContentView.publish({u"id": cv_id}) result = ContentView.version_list({u"content-view-id": cv_id}) version_id = result[0]["id"] ContentView.version_promote( { u"id": version_id, u"organization-id": HostCollectionTestCase.org["id"], u"to-lifecycle-environment-id": (HostCollectionTestCase.new_lifecycle["id"]), } ) HostCollectionTestCase.promoted_cv = HostCollectionTestCase.new_cv
def test_positive_update_aks_to_chost(self): """Check if multiple Activation keys can be attached to a Content host @Feature: Activation key - Content host @Assert: Multiple Activation keys are attached to a Content host """ env = make_lifecycle_environment({u"organization-id": self.org["id"]}) new_cv = make_content_view({u"organization-id": self.org["id"]}) ContentView.publish({u"id": new_cv["id"]}) cvv = ContentView.info({u"id": new_cv["id"]})["versions"][0] ContentView.version_promote({u"id": cvv["id"], u"to-lifecycle-environment-id": env["id"]}) new_aks = [ make_activation_key( { u"lifecycle-environment-id": env["id"], u"content-view": new_cv["name"], u"organization-id": self.org["id"], } ) for _ in range(2) ] with VirtualMachine(distro="rhel65") as vm: vm.install_katello_ca() for i in range(2): result = vm.register_contenthost(new_aks[i]["name"], self.org["label"]) self.assertEqual(result.return_code, 0)
def setUpClass(cls): """Tests for Content Host via Hammer CLI""" super(ContentHostTestCase, cls).setUpClass() ContentHostTestCase.NEW_ORG = make_org(cached=True) ContentHostTestCase.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': ContentHostTestCase.NEW_ORG['id']}, cached=True ) ContentHostTestCase.LIBRARY = LifecycleEnvironment.info({ u'organization-id': ContentHostTestCase.NEW_ORG['id'], u'name': u'Library', }) ContentHostTestCase.DEFAULT_CV = ContentView.info({ u'organization-id': ContentHostTestCase.NEW_ORG['id'], u'name': u'Default Organization View', }) ContentHostTestCase.NEW_CV = make_content_view({ u'organization-id': ContentHostTestCase.NEW_ORG['id'], }) cv_id = ContentHostTestCase.NEW_CV['id'] ContentView.publish({u'id': cv_id}) version_id = ContentView.version_list({ u'content-view-id': cv_id, })[0]['id'] ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': ContentHostTestCase.NEW_LIFECYCLE[ 'id' ], u'organization-id': ContentHostTestCase.NEW_ORG['id'] }) ContentHostTestCase.PROMOTED_CV = ContentHostTestCase.NEW_CV
def setUpClass(cls): """Tests for Content Host via Hammer CLI""" super(ContentHostTestCase, cls).setUpClass() ContentHostTestCase.NEW_ORG = make_org(cached=True) ContentHostTestCase.NEW_LIFECYCLE = make_lifecycle_environment( {u"organization-id": ContentHostTestCase.NEW_ORG["id"]}, cached=True ) ContentHostTestCase.LIBRARY = LifecycleEnvironment.info( {u"organization-id": ContentHostTestCase.NEW_ORG["id"], u"name": u"Library"} ) ContentHostTestCase.DEFAULT_CV = ContentView.info( {u"organization-id": ContentHostTestCase.NEW_ORG["id"], u"name": u"Default Organization View"} ) ContentHostTestCase.NEW_CV = make_content_view({u"organization-id": ContentHostTestCase.NEW_ORG["id"]}) cv_id = ContentHostTestCase.NEW_CV["id"] ContentView.publish({u"id": cv_id}) version_id = ContentView.version_list({u"content-view-id": cv_id})[0]["id"] ContentView.version_promote( { u"id": version_id, u"to-lifecycle-environment-id": ContentHostTestCase.NEW_LIFECYCLE["id"], u"organization-id": ContentHostTestCase.NEW_ORG["id"], } ) ContentHostTestCase.PROMOTED_CV = ContentHostTestCase.NEW_CV
def test_positive_chost_previous_env(self): """Check if the applicable errata are available from the content host's previous environment :id: 78110ba8-3942-46dd-8c14-bffa1dbd5195 :Setup: 1. Make sure multiple environments are present. 2. Content host's previous environments have additional errata. :Steps: Go to Content Hosts -> Select content host -> Errata Tab -> Select Previous environments. :expectedresults: The errata from previous environments are displayed. :CaseLevel: System """ with VirtualMachine(distro=DISTRO_RHEL7) as client: client.install_katello_ca() client.register_contenthost( self.session_org.label, self.activation_key.name, ) self.assertTrue(client.subscribed) client.enable_repo(REPOS['rhst7']['id']) client.install_katello_agent() client.run( 'yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) last_env_id = max( lce.id for lce in entities.LifecycleEnvironment( organization=self.session_org).search() ) new_env = entities.LifecycleEnvironment( organization=self.session_org, prior=last_env_id, ).create() cvv = ContentView.info({ 'id': self.content_view.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': self.session_org.id, 'to-lifecycle-environment-id': new_env.id, }) Host.update({ 'name': client.hostname, 'lifecycle-environment-id': new_env.id, 'organization-id': self.session_org.id, }) with Session(self): self.assertIsNotNone( self.contenthost.errata_search( client.hostname, CUSTOM_REPO_ERRATA_ID, environment_name=self.env.name, ) )
def test_promote_docker_repo_composite_content_view(self): """@Test: Add Docker-type repository to composite content view and publish it. Then promote it to the next available lifecycle-environment. @Assert: Docker-type repository is promoted to content view found in the specific lifecycle-environment. @Feature: Docker """ self._create_and_associate_repo_with_cv() ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id']}) self.assertEqual(len(self.content_view['versions']), 1) comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org_id, }) ContentView.update({ 'component-ids': self.content_view['versions'][0]['id'], 'id': comp_content_view['id'], }) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertIn( self.content_view['versions'][0]['id'], [ component['id'] for component in comp_content_view['components'] ], ) ContentView.publish({'id': comp_content_view['id']}) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) cvv = ContentView.version_info({ 'id': comp_content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), 1) lce = make_lifecycle_environment({'organization-id': self.org_id}) ContentView.version_promote({ 'id': comp_content_view['versions'][0]['id'], 'lifecycle-environment-id': lce['id'], }) cvv = ContentView.version_info({ 'id': comp_content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), 2)
def test_add_docker_repo_composite_view_to_activation_key(self): """@Test: Add Docker-type repository to a non-composite content view and publish it. Then add this content view to a composite content view and publish it. Create an activation key and associate it with the composite Docker content view. @Assert: Docker-based content view can be added to activation key @Feature: Docker """ comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org['id'], }) ContentView.update({ 'component-ids': self.content_view['versions'][0]['id'], 'id': comp_content_view['id'], }) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertIn( self.content_view['versions'][0]['id'], [ component['id'] for component in comp_content_view['components'] ], ) ContentView.publish({'id': comp_content_view['id']}) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) comp_cvv = ContentView.version_info({ 'id': comp_content_view['versions'][0]['id'], }) ContentView.version_promote({ 'id': comp_cvv['id'], 'lifecycle-environment-id': self.lce['id'], }) activation_key = make_activation_key({ 'content-view-id': comp_content_view['id'], 'lifecycle-environment-id': self.lce['id'], 'organization-id': self.org['id'], }) self.assertEqual( activation_key['content-view'], comp_content_view['name'])
def cv_publish_promote(cv, org, lce): """Publish and promote a new version into the given lifecycle environment. :param cv: content view :type cv: entities.ContentView :param org: organization :type org: entities.Organization :param lce: lifecycle environment :type lce: entities.LifecycleEnvironment """ ContentView.publish({'id': cv.id}) cvv = ContentView.info({'id': cv.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': org.id, 'to-lifecycle-environment-id': lce.id, })
def test_positive_validate_inherited_cv_lce(session, module_host_template): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI. :id: c83f6819-2649-4a8b-bb1d-ce93b2243765 :expectedresults: Host's lifecycle environment and content view match the ones specified in hostgroup. :CaseLevel: Integration :BZ: 1391656 """ lce = make_lifecycle_environment({'organization-id': module_host_template.organization.id}) content_view = make_content_view({'organization-id': module_host_template.organization.id}) ContentView.publish({'id': content_view['id']}) version_id = ContentView.version_list({'content-view-id': content_view['id']})[0]['id'] ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': lce['id'], 'organization-id': module_host_template.organization.id, }) hostgroup = make_hostgroup({ 'content-view-id': content_view['id'], 'lifecycle-environment-id': lce['id'], 'organization-ids': module_host_template.organization.id, }) puppet_proxy = Proxy.list({'search': 'name = {0}'.format(settings.server.hostname)})[0] host = make_host({ 'architecture-id': module_host_template.architecture.id, 'domain-id': module_host_template.domain.id, 'environment-id': module_host_template.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': module_host_template.location.id, 'medium-id': module_host_template.medium.id, 'operatingsystem-id': module_host_template.operatingsystem.id, 'organization-id': module_host_template.organization.id, 'partition-table-id': module_host_template.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with session: values = session.host.read(host['name'], ['host.lce', 'host.content_view']) assert values['host']['lce'] == lce['name'] assert values['host']['content_view'] == content_view['name']
def test_positive_usage_limit(self): """Test that Usage limit actually limits usage :id: 00ded856-e939-4140-ac84-91b6a8643623 :Steps: 1. Create Activation key 2. Update Usage Limit to a finite number 3. Register Content hosts to match the Usage Limit 4. Attempt to register an other Content host after reaching the Usage Limit :expectedresults: Content host Registration fails. Appropriate error shown :CaseLevel: System """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_ak = make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], u'max-hosts': '1', }) with VirtualMachine(distro=DISTRO_RHEL6) as vm1: with VirtualMachine(distro=DISTRO_RHEL6) as vm2: vm1.install_katello_ca() result = vm1.register_contenthost( self.org['label'], new_ak['name']) self.assertTrue(vm1.subscribed) vm2.install_katello_ca() result = vm2.register_contenthost( self.org['label'], new_ak['name']) self.assertFalse(vm2.subscribed) self.assertEqual(result.return_code, 70) self.assertGreater(len(result.stderr), 0)
def local_ak(local_org, local_environment, local_content_view): """Promote a content view version and create an activation key with CLI Factory""" cvv = ContentView.info({'id': local_content_view['id']})['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': local_environment['id'] }) return make_activation_key({ 'lifecycle-environment-id': local_environment['id'], 'content-view': local_content_view['name'], 'organization-id': local_org['id'], 'auto-attach': False, })
def test_remove_docker_repo_to_activation_key(self): """@Test: Add Docker-type repository to a non-composite content view and publish it. Create an activation key and associate it with the Docker content view. Then remove this content view from the activation key. @Assert: Docker-based content view can be added and then removed from the activation key. @Feature: Docker """ activation_key = make_activation_key({ 'content-view-id': self.content_view['id'], 'lifecycle-environment-id': self.lce['id'], 'organization-id': self.org['id'], }) self.assertEqual( activation_key['content-view'], self.content_view['name']) # Create another content view replace with another_cv = make_content_view({ 'composite': False, 'organization-id': self.org['id'], }) ContentView.publish({'id': another_cv['id']}) another_cv = ContentView.info({ 'id': another_cv['id']}) ContentView.version_promote({ 'id': another_cv['versions'][0]['id'], 'lifecycle-environment-id': self.lce['id'], }) ActivationKey.update({ 'id': activation_key['id'], 'organization-id': self.org['id'], 'content-view-id': another_cv['id'], }) activation_key = ActivationKey.info({ 'id': activation_key['id'], }) self.assertNotEqual( activation_key['content-view'], self.content_view['name'])
def test_positive_usage_limit(self): """@Test: Test that Usage limit actually limits usage @Feature: Activation key - Usage limit @Steps: 1. Create Activation key 2. Update Usage Limit to a finite number 3. Register Content hosts to match the Usage Limit 4. Attempt to register an other Content host after reaching the Usage Limit @Assert: Content host Registration fails. Appropriate error shown """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_ak = make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], u'unlimited-content-hosts': '0', u'max-content-hosts': '1', }) with VirtualMachine(distro='rhel65') as vm1: with VirtualMachine(distro='rhel65') as vm2: vm1.install_katello_ca() result = vm1.register_contenthost( new_ak['name'], self.org['label']) self.assertEqual(result.return_code, 0) vm2.install_katello_ca() result = vm2.register_contenthost( new_ak['name'], self.org['label']) self.assertEqual(result.return_code, 255) self.assertGreater(len(result.stderr), 0)
def setUp(self): """Tests for Host Collections via Hammer CLI""" super(HostCollectionTestCase, self).setUp() if HostCollectionTestCase.org is None: HostCollectionTestCase.org = make_org(cached=True) if HostCollectionTestCase.new_lifecycle is None: HostCollectionTestCase.new_lifecycle = make_lifecycle_environment( {u'organization-id': HostCollectionTestCase.org['id']}, cached=True) if HostCollectionTestCase.library is None: HostCollectionTestCase.library = LifecycleEnvironment.info({ u'organization-id': HostCollectionTestCase.org['id'], u'name': ENVIRONMENT, }) if HostCollectionTestCase.default_cv is None: HostCollectionTestCase.default_cv = ContentView.info({ u'organization-id': HostCollectionTestCase.org['id'], u'name': DEFAULT_CV }) if HostCollectionTestCase.new_cv is None: HostCollectionTestCase.new_cv = make_content_view( {u'organization-id': HostCollectionTestCase.org['id']}) HostCollectionTestCase.promoted_cv = None cv_id = HostCollectionTestCase.new_cv['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result[0]['id'] ContentView.version_promote({ u'id': version_id, u'organization-id': HostCollectionTestCase.org['id'], u'to-lifecycle-environment-id': (HostCollectionTestCase.new_lifecycle['id']), }) HostCollectionTestCase.promoted_cv = HostCollectionTestCase.new_cv
def test_positive_usage_limit(self): """Test that Usage limit actually limits usage @Feature: Activation key - Usage limit @Steps: 1. Create Activation key 2. Update Usage Limit to a finite number 3. Register Content hosts to match the Usage Limit 4. Attempt to register an other Content host after reaching the Usage Limit @Assert: Content host Registration fails. Appropriate error shown """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_ak = make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], u'max-content-hosts': '1', }) with VirtualMachine(distro='rhel65') as vm1: with VirtualMachine(distro='rhel65') as vm2: vm1.install_katello_ca() result = vm1.register_contenthost( new_ak['name'], self.org['label']) self.assertEqual(result.return_code, 0) vm2.install_katello_ca() result = vm2.register_contenthost( new_ak['name'], self.org['label']) self.assertEqual(result.return_code, 255) self.assertGreater(len(result.stderr), 0)
def test_positive_sync_publish_promote_cv(self): """Synchronize repository with DRPMs, add repository to content view, publish and promote content view to lifecycle environment @id: a01cb12b-d388-4902-8532-714f4e28ec56 @Assert: drpms can be listed in content view in proper lifecycle environment """ lce = make_lifecycle_environment({'organization-id': self.org['id']}) repo = make_repository({ 'product-id': self.product['id'], 'url': FAKE_YUM_DRPM_REPO, }) Repository.synchronize({'id': repo['id']}) cv = make_content_view({'organization-id': self.org['id']}) ContentView.add_repository({ 'id': cv['id'], 'repository-id': repo['id'], }) ContentView.publish({'id': cv['id']}) content_view = ContentView.info({'id': cv['id']}) cvv = content_view['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': lce['id'], }) result = ssh.command( 'ls /var/lib/pulp/published/yum/https/repos/{}/{}/{}/custom/{}/{}' '/drpms/ | grep .drpm'.format( self.org['label'], lce['label'], cv['label'], self.product['label'], repo['label'], )) self.assertEqual(result.return_code, 0) self.assertGreaterEqual(len(result.stdout), 1)
def test_positive_usage_limit(self): """Test that Usage limit actually limits usage @Feature: Activation key - Usage limit @Steps: 1. Create Activation key 2. Update Usage Limit to a finite number 3. Register Content hosts to match the Usage Limit 4. Attempt to register an other Content host after reaching the Usage Limit @Assert: Content host Registration fails. Appropriate error shown """ env = make_lifecycle_environment({u"organization-id": self.org["id"]}) new_cv = make_content_view({u"organization-id": self.org["id"]}) ContentView.publish({u"id": new_cv["id"]}) cvv = ContentView.info({u"id": new_cv["id"]})["versions"][0] ContentView.version_promote({u"id": cvv["id"], u"to-lifecycle-environment-id": env["id"]}) new_ak = make_activation_key( { u"lifecycle-environment-id": env["id"], u"content-view": new_cv["name"], u"organization-id": self.org["id"], u"unlimited-content-hosts": "0", u"max-content-hosts": "1", } ) with VirtualMachine(distro="rhel65") as vm1: with VirtualMachine(distro="rhel65") as vm2: vm1.install_katello_ca() result = vm1.register_contenthost(new_ak["name"], self.org["label"]) self.assertEqual(result.return_code, 0) vm2.install_katello_ca() result = vm2.register_contenthost(new_ak["name"], self.org["label"]) self.assertEqual(result.return_code, 255) self.assertGreater(len(result.stderr), 0)
def test_positive_update_lce(self): """Update Environment in an Activation key @Feature: Activation key - Positive Update @Assert: Activation key is updated """ ak_env = self._make_activation_key({u"lifecycle-environment-id": self.get_default_env()["id"]}) env = make_lifecycle_environment({u"organization-id": self.org["id"]}) new_cv = make_content_view({u"organization-id": self.org["id"]}) ContentView.publish({u"id": new_cv["id"]}) cvv = ContentView.info({u"id": new_cv["id"]})["versions"][0] ContentView.version_promote({u"id": cvv["id"], u"to-lifecycle-environment-id": env["id"]}) ActivationKey.update( { u"id": ak_env["id"], u"lifecycle-environment-id": env["id"], u"content-view": new_cv["name"], u"organization-id": self.org["id"], } ) updated_ak = ActivationKey.info({"id": ak_env["id"]}) self.assertEqual(updated_ak["lifecycle-environment"], env["name"])
def setUp(self): """Tests for Host Collections via Hammer CLI""" super(TestHostCollection, self).setUp() if TestHostCollection.org is None: TestHostCollection.org = make_org(cached=True) if TestHostCollection.new_lifecycle is None: TestHostCollection.new_lifecycle = make_lifecycle_environment( {u'organization-id': TestHostCollection.org['id']}, cached=True ) if TestHostCollection.library is None: TestHostCollection.library = LifecycleEnvironment.info({ u'organization-id': TestHostCollection.org['id'], u'name': ENVIRONMENT, }) if TestHostCollection.default_cv is None: TestHostCollection.default_cv = ContentView.info( {u'organization-id': TestHostCollection.org['id'], u'name': DEFAULT_CV} ) if TestHostCollection.new_cv is None: TestHostCollection.new_cv = make_content_view( {u'organization-id': TestHostCollection.org['id']} ) TestHostCollection.promoted_cv = None cv_id = TestHostCollection.new_cv['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result[0]['id'] ContentView.version_promote({ u'id': version_id, u'organization-id': TestHostCollection.org['id'], u'to-lifecycle-environment-id': ( TestHostCollection.new_lifecycle['id']), }) TestHostCollection.promoted_cv = TestHostCollection.new_cv
def setUp(self): # noqa """Tests for Content Host via Hammer CLI""" super(TestContentHost, self).setUp() if TestContentHost.NEW_ORG is None: TestContentHost.NEW_ORG = make_org(cached=True) if TestContentHost.NEW_LIFECYCLE is None: TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': TestContentHost.NEW_ORG['id']}, cached=True) if TestContentHost.LIBRARY is None: library_result = LifecycleEnvironment.info({ u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Library' }) TestContentHost.LIBRARY = library_result.stdout if TestContentHost.DEFAULT_CV is None: cv_result = ContentView.info({ u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Default Organization View' }) TestContentHost.DEFAULT_CV = cv_result.stdout if TestContentHost.NEW_CV is None: TestContentHost.NEW_CV = make_content_view( {u'organization-id': TestContentHost.NEW_ORG['id']}) TestContentHost.PROMOTED_CV = None cv_id = TestContentHost.NEW_CV['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result.stdout[0]['id'] promotion = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': TestContentHost.NEW_LIFECYCLE['id'], u'organization-id': TestContentHost.NEW_ORG['id'] }) if promotion.stderr == []: TestContentHost.PROMOTED_CV = TestContentHost.NEW_CV
def setUp(self): # noqa """Tests for Host Collections via Hammer CLI""" super(TestHostCollection, self).setUp() if TestHostCollection.org is None: TestHostCollection.org = make_org(cached=True) if TestHostCollection.new_lifecycle is None: TestHostCollection.new_lifecycle = make_lifecycle_environment( {u'organization-id': TestHostCollection.org['id']}, cached=True) if TestHostCollection.library is None: library_result = LifecycleEnvironment.info({ u'organization-id': TestHostCollection.org['id'], u'name': u'Library' }) TestHostCollection.library = library_result.stdout if TestHostCollection.default_cv is None: cv_result = ContentView.info({ u'organization-id': TestHostCollection.org['id'], u'name': u'Default Organization View' }) TestHostCollection.default_cv = cv_result.stdout if TestHostCollection.new_cv is None: TestHostCollection.new_cv = make_content_view( {u'organization-id': TestHostCollection.org['id']}) TestHostCollection.promoted_cv = None cv_id = TestHostCollection.new_cv['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result.stdout[0]['id'] promotion = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': (TestHostCollection.new_lifecycle['id']), u'organization-id': TestHostCollection.org['id'] }) if promotion.stderr == []: TestHostCollection.promoted_cv = TestHostCollection.new_cv
def setUp(self): # noqa """Tests for Host Collections via Hammer CLI""" super(TestHostCollection, self).setUp() if TestHostCollection.org is None: TestHostCollection.org = make_org(cached=True) if TestHostCollection.new_lifecycle is None: TestHostCollection.new_lifecycle = make_lifecycle_environment( {u'organization-id': TestHostCollection.org['id']}, cached=True ) if TestHostCollection.library is None: result = LifecycleEnvironment.info({ u'organization-id': TestHostCollection.org['id'], u'name': u'Library', }) self.assertEqual(result.return_code, 0) TestHostCollection.library = result.stdout if TestHostCollection.default_cv is None: result = ContentView.info( {u'organization-id': TestHostCollection.org['id'], u'name': u'Default Organization View'} ) self.assertEqual(result.return_code, 0) TestHostCollection.default_cv = result.stdout if TestHostCollection.new_cv is None: TestHostCollection.new_cv = make_content_view( {u'organization-id': TestHostCollection.org['id']} ) TestHostCollection.promoted_cv = None cv_id = TestHostCollection.new_cv['id'] result = ContentView.publish({u'id': cv_id}) self.assertEqual(result.return_code, 0) result = ContentView.version_list({u'content-view-id': cv_id}) self.assertEqual(result.return_code, 0) version_id = result.stdout[0]['id'] result = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': ( TestHostCollection.new_lifecycle['id']), u'organization-id': TestHostCollection.org['id'] }) self.assertEqual(result.return_code, 0) TestHostCollection.promoted_cv = TestHostCollection.new_cv
def setUp(self): # noqa """Tests for Content Host via Hammer CLI""" super(TestContentHost, self).setUp() if TestContentHost.NEW_ORG is None: TestContentHost.NEW_ORG = make_org(cached=True) if TestContentHost.NEW_LIFECYCLE is None: TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': TestContentHost.NEW_ORG['id']}, cached=True) if TestContentHost.LIBRARY is None: result = LifecycleEnvironment.info({ u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Library', }) self.assertEqual(result.return_code, 0) TestContentHost.LIBRARY = result.stdout if TestContentHost.DEFAULT_CV is None: result = ContentView.info({ u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Default Organization View', }) self.assertEqual(result.return_code, 0) TestContentHost.DEFAULT_CV = result.stdout if TestContentHost.NEW_CV is None: TestContentHost.NEW_CV = make_content_view({ u'organization-id': TestContentHost.NEW_ORG['id'], }) TestContentHost.PROMOTED_CV = None cv_id = TestContentHost.NEW_CV['id'] result = ContentView.publish({u'id': cv_id}) self.assertEqual(result.return_code, 0) result = ContentView.version_list({u'content-view-id': cv_id}) self.assertEqual(result.return_code, 0) version_id = result.stdout[0]['id'] result = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': TestContentHost.NEW_LIFECYCLE[ 'id'], u'organization-id': TestContentHost.NEW_ORG['id'] }) self.assertEqual(result.return_code, 0) TestContentHost.PROMOTED_CV = TestContentHost.NEW_CV
def setUp(self): """ Tests for Content Host via Hammer CLI """ super(TestContentHost, self).setUp() if TestContentHost.NEW_ORG is None: TestContentHost.NEW_ORG = make_org() if TestContentHost.NEW_LIFECYCLE is None: TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': TestContentHost.NEW_ORG['id']} ) if TestContentHost.LIBRARY is None: library_result = LifecycleEnvironment.info( {u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Library'} ) TestContentHost.LIBRARY = library_result.stdout if TestContentHost.DEFAULT_CV is None: cv_result = ContentView.info( {u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Default Organization View'} ) TestContentHost.DEFAULT_CV = cv_result.stdout if TestContentHost.NEW_CV is None: TestContentHost.NEW_CV = make_content_view( {u'organization-id': TestContentHost.NEW_ORG['id']} ) TestContentHost.PROMOTED_CV = None cv_id = TestContentHost.NEW_CV['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result.stdout[0]['id'] promotion = ContentView.version_promote({ u'id': version_id, u'lifecycle-environment-id': TestContentHost.NEW_LIFECYCLE[ 'id'], u'organization-id': TestContentHost.NEW_ORG['id'] }) if promotion.stderr == []: TestContentHost.PROMOTED_CV = TestContentHost.NEW_CV
def setUp(self): """Tests for Host Collections via Hammer CLI""" super(TestHostCollection, self).setUp() if TestHostCollection.org is None: TestHostCollection.org = make_org() if TestHostCollection.new_lifecycle is None: TestHostCollection.new_lifecycle = make_lifecycle_environment( {u'organization-id': TestHostCollection.org['id']} ) if TestHostCollection.library is None: library_result = LifecycleEnvironment.info( {u'organization-id': TestHostCollection.org['id'], u'name': u'Library'} ) TestHostCollection.library = library_result.stdout if TestHostCollection.default_cv is None: cv_result = ContentView.info( {u'organization-id': TestHostCollection.org['id'], u'name': u'Default Organization View'} ) TestHostCollection.default_cv = cv_result.stdout if TestHostCollection.new_cv is None: TestHostCollection.new_cv = make_content_view( {u'organization-id': TestHostCollection.org['id']} ) TestHostCollection.promoted_cv = None cv_id = TestHostCollection.new_cv['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result.stdout[0]['id'] promotion = ContentView.version_promote({ u'id': version_id, u'lifecycle-environment-id': TestHostCollection.new_lifecycle[ 'id'], u'organization-id': TestHostCollection.org['id'] }) if promotion.stderr == []: TestHostCollection.promoted_cv = TestHostCollection.new_cv
def test_positive_filter(self): """Filter Content hosts by environment :id: 578c3a92-c4d8-4933-b122-7ff511c276ec :Setup: Errata synced on satellite server. :Steps: Go to Content -> Errata. Select an Errata -> Content Hosts tab -> Filter content hosts by Environment. :expectedresults: Content hosts can be filtered by Environment. :CaseLevel: System """ with VirtualMachine(distro=DISTRO_RHEL7) as client1, VirtualMachine( distro=DISTRO_RHEL7) as client2: for client in client1, client2: client.install_katello_ca() result = client.register_contenthost( self.session_org.label, self.activation_key.name, ) self.assertEqual(result.return_code, 0) client.enable_repo(REPOS['rhst7']['id']) client.install_katello_agent() client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) last_env_id = max(lce.id for lce in entities.LifecycleEnvironment( organization=self.session_org).search()) new_env = entities.LifecycleEnvironment( organization=self.session_org, prior=last_env_id, ).create() cvv = ContentView.info({'id': self.content_view.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': self.session_org.id, 'to-lifecycle-environment-id': new_env.id, }) Host.update({ 'name': client1.hostname, 'lifecycle-environment-id': new_env.id, 'organization-id': self.session_org.id, }) with Session(self.browser): self.assertIsNotNone( self.errata.contenthost_search( CUSTOM_REPO_ERRATA_ID, client1.hostname, environment=new_env.name, )) self.assertIsNone( self.errata.contenthost_search( CUSTOM_REPO_ERRATA_ID, client2.hostname, environment=new_env.name, )) self.assertIsNotNone( self.errata.contenthost_search( CUSTOM_REPO_ERRATA_ID, client2.hostname, environment=self.env.name, )) self.assertIsNone( self.errata.contenthost_search( CUSTOM_REPO_ERRATA_ID, client1.hostname, environment=self.env.name, ))
def test_positive_create_with_multiple_entities_ids(self): """Check if hostgroup with multiple options ids can be created :id: 6277613b-0ece-4dee-b9d8-504f8299ac38 :expectedresults: Hostgroup should be created and has all defined entities assigned :BZ: 1395254, 1313056 :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) make_hostgroup_params = { 'location-ids': loc['id'], 'environment-id': env['id'], 'lifecycle-environment-id': lce['id'], 'puppet-proxy-id': proxy['id'], 'puppet-ca-proxy-id': proxy['id'], 'content-source-id': proxy['id'], 'content-view-id': cv['id'], 'domain-id': domain['id'], 'subnet-id': subnet['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'medium-id': media['id'], 'operatingsystem-id': os['id'], } hostgroup = make_hostgroup(make_hostgroup_params) self.assertEqual(cv['id'], hostgroup['content-view']['id']) self.assertEqual(lce['id'], hostgroup['lifecycle-environment']['id']) self.assertEqual(proxy['id'], hostgroup['content-source']['id']) # get the json output format hostgroup = HostGroup.info({'id': hostgroup['id']}, output_format='json') self.assertIn(org['id'], hostgroup['organizations'][0]['id']) self.assertIn(loc['id'], hostgroup['locations'][0]['id']) self.assertEqual(env['id'], hostgroup['puppet-environment']['id']) self.assertEqual(proxy['id'], hostgroup['puppet-master-proxy']['id']) self.assertEqual(proxy['id'], hostgroup['puppet-ca-proxy']['id']) self.assertEqual(domain['id'], hostgroup['network']['domain']['id']) self.assertEqual(subnet['id'], hostgroup['network']['subnet-ipv4']['id']) self.assertEqual(arch['id'], hostgroup['operating-system']['architecture']['id']) self.assertEqual( ptable['id'], hostgroup['operating-system']['partition-table']['id']) self.assertEqual(media['id'], hostgroup['operating-system']['medium']['id']) self.assertEqual( os['id'], hostgroup['operating-system']['operating-system']['id'])
def test_positive_create_with_synced_content(self): """Check if hostgroup with synced kickstart repository can be created :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a :customerscenario: true :expectedresults: Hostgroup should be created and has proper installation content id present :BZ: 1415707 :CaseLevel: Integration """ # Check whether path to kickstart media is set if settings.rhel6_os is None: raise ValueError( 'Installation media path is not set in properties file') # Common entities org = make_org() lce = make_lifecycle_environment({'organization-id': org['id']}) product = make_product({'organization-id': org['id']}) repo = make_repository({ u'url': settings.rhel6_os, u'product-id': product['id'], u'content-type': u'yum', }) Repository.synchronize({'id': repo['id']}) cv = make_content_view({ 'organization-id': org['id'], 'repository-ids': [repo['id']], }) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) cvv = cv['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': lce['id'], }) # Get the Partition table ID ptable = PartitionTable.info({'name': DEFAULT_PTABLE}) # Get the arch ID arch = Architecture.list( {'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0] # Get the OS ID os = OperatingSys.list({ 'search': 'name="RedHat" AND major="{0}" OR major="{1}"'.format( RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION) })[0] # Update the OS with found arch and ptable OperatingSys.update({ 'id': os['id'], 'architectures': arch['name'], 'partition-tables': ptable['name'], }) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Search for proper installation repository id synced_repo = Repository.list({ 'content-view-version-id': cvv['id'], 'organization-id': org['id'], 'environment-id': lce['id'], })[0] hostgroup = make_hostgroup({ 'lifecycle-environment-id': lce['id'], 'puppet-proxy-id': proxy['id'], 'puppet-ca-proxy-id': proxy['id'], 'content-source-id': proxy['id'], 'content-view-id': cv['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'operatingsystem-id': os['id'], 'kickstart-repository-id': synced_repo['id'], }) hg = HostGroup.info({'id': hostgroup['id']}, output_format='json') self.assertEqual(hg['kickstart-repository']['id'], synced_repo['id'])
def test_positive_create_with_synced_content(self): """Check if hostgroup with synced kickstart repository can be created :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a :customerscenario: true :expectedresults: Hostgroup should be created and has proper installation content id present :BZ: 1415707 :CaseLevel: Integration """ # Check whether path to kickstart media is set if settings.rhel6_os is None: raise ValueError( 'Installation media path is not set in properties file') # Common entities org = make_org() lce = make_lifecycle_environment({'organization-id': org['id']}) product = make_product({'organization-id': org['id']}) repo = make_repository({ u'url': settings.rhel6_os, u'product-id': product['id'], u'content-type': u'yum', }) Repository.synchronize({'id': repo['id']}) cv = make_content_view({ 'organization-id': org['id'], 'repository-ids': [repo['id']], }) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) cvv = cv['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': lce['id'], }) # Get the Partition table ID ptable = PartitionTable.info({'name': DEFAULT_PTABLE}) # Get the arch ID arch = Architecture.list({ 'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0] # Get the OS ID os = OperatingSys.list({ 'search': 'name="RedHat" AND major="{0}" OR major="{1}"'.format( RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION) })[0] # Update the OS with found arch and ptable OperatingSys.update({ 'id': os['id'], 'architectures': arch['name'], 'partition-tables': ptable['name'], }) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Search for proper installation repository id synced_repo = Repository.list({ 'content-view-version-id': cvv['id'], 'organization-id': org['id'], 'environment-id': lce['id'], })[0] hostgroup = make_hostgroup({ 'lifecycle-environment-id': lce['id'], 'puppet-proxy-id': proxy['id'], 'puppet-ca-proxy-id': proxy['id'], 'content-source-id': proxy['id'], 'content-view-id': cv['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'operatingsystem-id': os['id'], 'kickstart-repository-id': synced_repo['id'], }) hg = HostGroup.info({'id': hostgroup['id']}, output_format='json') self.assertEqual( hg['operating-system']['kickstart_repository_id'], synced_repo['id'] )
def test_positive_create_with_multiple_entities_name(self): """Check if hostgroup with multiple options name can be created :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created and has all defined entities assigned :BZ: 1395254, 1313056 :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) os_full_name = "{0} {1}.{2}".format(os['name'], os['major-version'], os['minor-version']) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'organizations': org['name'], 'locations': loc['name'], 'environment': env['name'], 'lifecycle-environment': lce['name'], 'puppet-proxy': proxy['name'], 'puppet-ca-proxy': proxy['name'], 'content-source-id': proxy['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'query-organization': org['name'] } hostgroup = make_hostgroup(make_hostgroup_params) self.assertIn(org['name'], hostgroup['organizations']) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['puppet-environment']) self.assertEqual(proxy['name'], hostgroup['puppet-master-proxy']) self.assertEqual(proxy['name'], hostgroup['puppet-ca-proxy']) self.assertEqual(domain['name'], hostgroup['network']['domain']) self.assertEqual(subnet['name'], hostgroup['network']['subnet-ipv4']) self.assertEqual(arch['name'], hostgroup['operating-system']['architecture']) self.assertEqual(ptable['name'], hostgroup['operating-system']['partition-table']) self.assertEqual(media['name'], hostgroup['operating-system']['medium']) self.assertEqual(os_full_name, hostgroup['operating-system']['operating-system']) self.assertEqual(cv['name'], hostgroup['content-view']['name']) self.assertEqual(lce['name'], hostgroup['lifecycle-environment']['name']) self.assertEqual(proxy['name'], hostgroup['content-source']['name'])
def test_positive_show_count_on_chost_page(self): """Available errata count displayed in Content hosts page :id: 8575e282-d56e-41dc-80dd-f5f6224417cb :Setup: 1. Errata synced on satellite server. 2. Some content hosts are present. :Steps: Go to Hosts -> Content Hosts. :expectedresults: 1. The available errata count is displayed. 2. Errata count is displayed with color icons. - An errata count of 0 = black - If security errata, >0 = red - If any other errata, >0 = yellow :CaseLevel: System """ org = entities.Organization().create() env = entities.LifecycleEnvironment(organization=org).create() content_view = entities.ContentView(organization=org).create() activation_key = entities.ActivationKey( environment=env, organization=org, ).create() setup_org_for_a_rh_repo({ 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst6'], 'repository': REPOS['rhst6']['name'], 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) setup_org_for_a_custom_repo({ 'url': CUSTOM_REPO_URL, 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) RepositorySet.enable({ 'basearch': DEFAULT_ARCHITECTURE, 'name': REPOSET['rhva6'], 'organization-id': org.id, 'product': PRDS['rhel'], 'releasever': DEFAULT_RELEASE_VERSION, }) rhel_repo = Repository.info({ 'name': REPOS['rhva6']['name'], 'organization-id': org.id, 'product': PRDS['rhel'], }) Repository.synchronize({ 'name': REPOS['rhva6']['name'], 'organization-id': org.id, 'product': PRDS['rhel'], }) ContentView.add_repository({ 'id': content_view.id, 'organization-id': org.id, 'repository-id': rhel_repo['id'], }) ContentView.publish({'id': content_view.id}) cvv = ContentView.info({'id': content_view.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': org.id, 'to-lifecycle-environment-id': env.id, }) with VirtualMachine(distro=DISTRO_RHEL6) as client: client.install_katello_ca() result = client.register_contenthost( org.label, activation_key.name, ) self.assertEqual(result.return_code, 0) client.enable_repo(REPOS['rhst6']['id']) client.enable_repo(REPOS['rhva6']['id']) client.install_katello_agent() with Session(self.browser) as session: session.nav.go_to_select_org(org.name) result = self.contenthost.fetch_errata_counts(client.hostname) for errata in ('security', 'bug_fix', 'enhancement'): self.assertEqual(result[errata]['value'], 0) self.assertEqual(result[errata]['color'], 'black') client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) result = self.contenthost.fetch_errata_counts(client.hostname) self.assertEqual(result['security']['value'], 1) self.assertEqual(result['security']['color'], 'red') client.run('yum install -y {0}'.format(REAL_0_RH_PACKAGE)) result = self.contenthost.fetch_errata_counts(client.hostname) for errata in ('bug_fix', 'enhancement'): self.assertEqual(result[errata]['value'], 1) self.assertEqual(result[errata]['color'], 'yellow')
def test_positive_create_with_multiple_entities_ids(self): """Check if hostgroup with multiple options ids can be created :id: 6277613b-0ece-4dee-b9d8-504f8299ac38 :expectedresults: Hostgroup should be created and has all defined entities assigned :BZ: 1395254, 1313056 :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) make_hostgroup_params = { 'location-ids': loc['id'], 'environment-id': env['id'], 'lifecycle-environment-id': lce['id'], 'puppet-proxy-id': proxy['id'], 'puppet-ca-proxy-id': proxy['id'], 'content-source-id': proxy['id'], 'content-view-id': cv['id'], 'domain-id': domain['id'], 'subnet-id': subnet['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'medium-id': media['id'], 'operatingsystem-id': os['id'], } hostgroup = make_hostgroup(make_hostgroup_params) self.assertEqual(cv['id'], hostgroup['content-view']['id']) self.assertEqual(lce['id'], hostgroup['lifecycle-environment']['id']) self.assertEqual(proxy['id'], hostgroup['content-source']['id']) # get the json output format hostgroup = HostGroup.info( {'id': hostgroup['id']}, output_format='json') self.assertIn(org['id'], hostgroup['organizations'][0]['id']) self.assertIn(loc['id'], hostgroup['locations'][0]['id']) self.assertEqual( env['id'], hostgroup['puppet-environment']['environment_id']) self.assertEqual(proxy['id'], hostgroup['puppet-master-proxy-id']) self.assertEqual(proxy['id'], hostgroup['puppet-ca-proxy-id']) self.assertEqual(domain['id'], hostgroup['domain']['domain_id']) self.assertEqual( subnet['id'], hostgroup['network']['subnet-ipv4']['id']) self.assertEqual( arch['id'], hostgroup['architecture']['architecture_id']) self.assertEqual( ptable['id'], hostgroup['partition-table']['ptable_id']) self.assertEqual(media['id'], hostgroup['medium']['medium_id']) self.assertEqual( os['id'], hostgroup['operating-system']['operatingsystem_id'])
def test_end_to_end(self): """@Test: Perform end to end smoke tests using RH repos. 1. Create new organization and environment 2. Upload manifest 3. Sync a RedHat repository 4. Create content-view 5. Add repository to contet-view 6. Promote/publish content-view 7. Create an activation-key 8. Add product to activation-key 9. Create new virtualmachine 10. Pull rpm from Foreman server and install on client 11. Register client with foreman server using activation-key 12. Install rpm on client @Feature: Smoke test @Assert: All tests should succeed and Content should be successfully fetched by client """ # Product, RepoSet and repository variables rhel_product_name = 'Red Hat Enterprise Linux Server' rhel_repo_set = ( 'Red Hat Enterprise Virtualization Agents ' 'for RHEL 6 Server (RPMs)' ) rhel_repo_name = ( 'Red Hat Enterprise Virtualization Agents ' 'for RHEL 6 Server ' 'RPMs x86_64 6Server' ) org_name = random.choice(generate_strings_list()) # Create new org and environment new_org = make_org({u'name': org_name}) new_env = make_lifecycle_environment({ u'organization-id': new_org['id'], u'name': gen_alphanumeric(), }) # Clone manifest and upload it manifest = manifests.clone() upload_file(manifest, remote_file=manifest) result = Subscription.upload({ u'file': manifest, u'organization-id': new_org['id'], }) self.assertEqual( result.return_code, 0, "Failed to upload manifest: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Enable repo from Repository Set result = RepositorySet.enable({ u'name': rhel_repo_set, u'organization-id': new_org['id'], u'product': rhel_product_name, u'releasever': '6Server', u'basearch': 'x86_64', }) self.assertEqual( result.return_code, 0, "Repo was not enabled: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Fetch repository info result = Repository.info({ u'name': rhel_repo_name, u'product': rhel_product_name, u'organization-id': new_org['id'], }) rhel_repo = result.stdout # Synchronize the repository result = Repository.synchronize({ u'name': rhel_repo_name, u'organization-id': new_org['id'], u'product': rhel_product_name, }) self.assertEqual( result.return_code, 0, "Repo was not synchronized: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Create CV and associate repo to it new_cv = make_content_view({u'organization-id': new_org['id']}) result = ContentView.add_repository({ u'id': new_cv['id'], u'repository-id': rhel_repo['id'], u'organization-id': new_org['id'], }) self.assertEqual( result.return_code, 0, "Failed repository association: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Publish a version1 of CV result = ContentView.publish({u'id': new_cv['id']}) self.assertEqual( result.return_code, 0, "Version1 publishing failed: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Get the CV info result = ContentView.info({u'id': new_cv['id']}) self.assertEqual( result.return_code, 0, "ContentView was not found: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Store the version1 id version1_id = result.stdout['versions'][0]['id'] # Promotion of version1 to next env result = ContentView.version_promote({ u'id': version1_id, u'to-lifecycle-environment-id': new_env['id'], }) self.assertEqual( result.return_code, 0, "version1 promotion failed: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Create activation key activation_key = make_activation_key({ u'name': gen_alphanumeric(), u'lifecycle-environment-id': new_env['id'], u'organization-id': new_org['id'], u'content-view': new_cv['name'], }) # List the subscriptions in given org result = Subscription.list( {u'organization-id': new_org['id']}, per_page=False ) self.assertEqual( result.return_code, 0, "Failed to list subscriptions: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Get the subscription ID from subscriptions list for subscription in result.stdout: if subscription['name'] == "Red Hat Employee Subscription": subscription_id = subscription['id'] subscription_quantity = int(subscription['quantity']) self.assertGreater( int(subscription_quantity), 0, 'Unexpected subscription quantity {0}' .format(subscription_quantity) ) # Add the subscriptions to activation-key result = ActivationKey.add_subscription({ u'id': activation_key['id'], u'subscription-id': subscription_id, u'quantity': 1, }) self.assertEqual( result.return_code, 0, "Failed to add subscription: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Create VM package_name = "python-kitchen" server_name = conf.properties['main.server.hostname'] with VirtualMachine(distro='rhel66') as vm: # Download and Install rpm result = vm.run( "wget -nd -r -l1 --no-parent -A '*.noarch.rpm' http://{0}/pub/" .format(server_name) ) self.assertEqual( result.return_code, 0, "failed to fetch katello-ca rpm: {0}, return code: {1}" .format(result.stderr, result.return_code) ) result = vm.run( 'rpm -i katello-ca-consumer*.noarch.rpm' ) self.assertEqual( result.return_code, 0, "failed to install katello-ca rpm: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Register client with foreman server using activation-key result = vm.run( u'subscription-manager register --activationkey {0} ' '--org {1} --force' .format(activation_key['name'], new_org['label']) ) self.assertEqual( result.return_code, 0, "failed to register client:: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Enable Red Hat Enterprise Virtualization Agents repo via cli # As the below repo is disabled by default under ak's prd-content result = vm.run( 'subscription-manager repos --enable ' 'rhel-6-server-rhev-agent-rpms' ) self.assertEqual( result.return_code, 0, "Enabling repo failed: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Install contents from sat6 server result = vm.run('yum install -y {0}'.format(package_name)) self.assertEqual( result.return_code, 0, "Package install failed: {0} and return code: {1}" .format(result.stderr, result.return_code) ) # Verify if package is installed by query it result = vm.run('rpm -q {0}'.format(package_name)) self.assertIn(package_name, result.stdout[0])
def test_positive_create_with_multiple_entities_and_delete(self): """Check if hostgroup with multiple options can be created and deleted :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created, has all defined entities assigned and deleted :BZ: 1395254, 1313056 :CaseLevel: Integration :CaseImportance: Critical """ # Common entities name = valid_hostgroups_list()[0] loc = make_location() org = make_org() orgs = [org, self.org] env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'] }) lce = make_lifecycle_environment({'organization-id': org['id']}) # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'] }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'] }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'] }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'] }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'] }) os_full_name = "{0} {1}.{2}".format(os['name'], os['major-version'], os['minor-version']) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'name': name, 'organization-ids': [org['id'] for org in orgs], 'locations': loc['name'], 'environment': env['name'], 'lifecycle-environment': lce['name'], 'puppet-proxy': self.content_source['name'], 'puppet-ca-proxy': self.content_source['name'], 'content-source-id': self.content_source['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'puppet-classes': self.puppet_classes[0]['name'], 'query-organization': org['name'], } hostgroup = make_hostgroup(make_hostgroup_params) self.assertEqual(hostgroup['name'], name) self.assertEqual(set(org['name'] for org in orgs), set(hostgroup['organizations'])) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['puppet-environment']) self.assertEqual(self.content_source['name'], hostgroup['puppet-master-proxy']) self.assertEqual(self.content_source['name'], hostgroup['puppet-ca-proxy']) self.assertEqual(domain['name'], hostgroup['network']['domain']) self.assertEqual(subnet['name'], hostgroup['network']['subnet-ipv4']) self.assertEqual(arch['name'], hostgroup['operating-system']['architecture']) self.assertEqual(ptable['name'], hostgroup['operating-system']['partition-table']) self.assertEqual(media['name'], hostgroup['operating-system']['medium']) self.assertEqual(os_full_name, hostgroup['operating-system']['operating-system']) self.assertEqual(cv['name'], hostgroup['content-view']['name']) self.assertEqual(lce['name'], hostgroup['lifecycle-environment']['name']) self.assertEqual(self.content_source['name'], hostgroup['content-source']['name']) self.assertIn(self.puppet_classes[0]['name'], hostgroup['puppetclasses']) # delete hostgroup HostGroup.delete({'id': hostgroup['id']}) with self.assertRaises(CLIReturnCodeError): HostGroup.info({'id': hostgroup['id']})
def test_positive_create_with_multiple_entities_and_delete( module_puppet_org, puppet_content_source, puppet_classes, session_puppet_enabled_sat): """Check if hostgroup with multiple options can be created and deleted :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created, has all defined entities assigned and deleted :BZ: 1395254, 1313056 :CaseLevel: Integration :CaseImportance: Critical """ with session_puppet_enabled_sat: # Common entities name = valid_hostgroups_list()[0] loc = make_location() org_2 = entities.Organization().create() orgs = [module_puppet_org, org_2] env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org_2.id }) lce = make_lifecycle_environment({'organization-id': org_2.id}) # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org_2.id}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'] }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org_2.id }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org_2.id }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org_2.id }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'] }) os_full_name = "{} {}.{}".format(os['name'], os['major-version'], os['minor-version']) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org_2.id, }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'name': name, 'organization-ids': [org.id for org in orgs], 'locations': loc['name'], 'puppet-environment': env['name'], 'lifecycle-environment-id': lce['id'], 'puppet-proxy': puppet_content_source['name'], 'puppet-ca-proxy': puppet_content_source['name'], 'content-source-id': puppet_content_source['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'puppet-classes': puppet_classes[0]['name'], 'query-organization': org_2.name, } hostgroup = make_hostgroup(make_hostgroup_params) assert hostgroup['name'] == name assert {org.name for org in orgs} == set(hostgroup['organizations']) assert loc['name'] in hostgroup['locations'] assert env['name'] == hostgroup['puppet-environment'] assert puppet_content_source['name'] == hostgroup[ 'puppet-master-proxy'] assert puppet_content_source['name'] == hostgroup['puppet-ca-proxy'] assert domain['name'] == hostgroup['network']['domain'] assert subnet['name'] == hostgroup['network']['subnet-ipv4'] assert arch['name'] == hostgroup['operating-system']['architecture'] assert ptable['name'] == hostgroup['operating-system'][ 'partition-table'] assert media['name'] == hostgroup['operating-system']['medium'] assert os_full_name == hostgroup['operating-system'][ 'operating-system'] assert cv['name'] == hostgroup['content-view']['name'] assert lce['name'] == hostgroup['lifecycle-environment']['name'] assert puppet_content_source['name'] == hostgroup['content-source'][ 'name'] assert puppet_classes[0]['name'] in hostgroup['puppetclasses'] # delete hostgroup HostGroup.delete({'id': hostgroup['id']}) with pytest.raises(CLIReturnCodeError): HostGroup.info({'id': hostgroup['id']})
def test_positive_create_with_multiple_entities(self): """Check if hostgroup with multiple options can be created :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created and has all defined entities assigned :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) puppet_proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) make_hostgroup_params = { 'location-ids': loc['id'], 'environment-id': env['id'], 'lifecycle-environment': lce['name'], 'puppet-proxy-id': puppet_proxy['id'], 'puppet-ca-proxy-id': puppet_proxy['id'], 'content-view-id': cv['id'], 'domain-id': domain['id'], 'subnet-id': subnet['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'medium-id': media['id'], 'operatingsystem-id': os['id'], } # If bug is open provide LCE id as parameter # because LCE name cause errors if bz_bug_is_open(1395254): make_hostgroup_params.pop('lifecycle-environment') make_hostgroup_params['lifecycle-environment-id'] = lce['id'] hostgroup = make_hostgroup(make_hostgroup_params) self.assertIn(org['name'], hostgroup['organizations']) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['environment']) self.assertEqual(puppet_proxy['id'], hostgroup['puppet-master-proxy-id']) self.assertEqual(puppet_proxy['id'], hostgroup['puppet-ca-proxy-id']) self.assertEqual(domain['name'], hostgroup['domain']) self.assertEqual(subnet['name'], hostgroup['subnet']) self.assertEqual(arch['name'], hostgroup['architecture']) self.assertEqual(ptable['name'], hostgroup['partition-table']) self.assertEqual(media['name'], hostgroup['medium']) self.assertEqual( "{0} {1}.{2}".format(os['name'], os['major-version'], os['minor-version']), hostgroup['operating-system']) if not bz_bug_is_open('1313056'): self.assertEqual(cv['name'], hostgroup['content-view']) self.assertEqual(lce['name'], hostgroup['lifecycle-environment'])
def test_positive_validate_inherited_cv_lce(self): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI :id: c83f6819-2649-4a8b-bb1d-ce93b2243765 :expectedresults: Host's lifecycle environment and content view match the ones specified in hostgroup :CaseLevel: Integration :BZ: 1391656 """ host = entities.Host() host.create_missing() new_lce = cli_factory.make_lifecycle_environment( {'organization-id': host.organization.id}) new_cv = cli_factory.make_content_view( {'organization-id': host.organization.id}) cli_ContentView.publish({'id': new_cv['id']}) version_id = cli_ContentView.version_list({ 'content-view-id': new_cv['id'], })[0]['id'] cli_ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': new_lce['id'], 'organization-id': host.organization.id, }) hostgroup = cli_factory.make_hostgroup({ 'content-view-id': new_cv['id'], 'lifecycle-environment-id': new_lce['id'], 'organization-ids': host.organization.id, }) puppet_proxy = cli_Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] cli_factory.make_host({ 'architecture-id': host.architecture.id, 'domain-id': host.domain.id, 'environment-id': host.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': host.location.id, 'medium-id': host.medium.id, 'name': host.name, 'operatingsystem-id': host.operatingsystem.id, 'organization-id': host.organization.id, 'partition-table-id': host.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with Session(self.browser) as session: set_context(session, host.organization.name, host.location.name) result = self.hosts.fetch_host_parameters( host.name, host.domain.name, [['Host', 'Lifecycle Environment'], ['Host', 'Content View']], ) self.assertEqual(result['Lifecycle Environment'], new_lce['name']) self.assertEqual(result['Content View'], new_cv['name'])
def test_positive_validate_inherited_cv_lce(self): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI @id: c83f6819-2649-4a8b-bb1d-ce93b2243765 @Assert: Host's lifecycle environment and content view match the ones specified in hostgroup @CaseLevel: Integration @BZ: 1391656 """ host = entities.Host() host.create_missing() new_lce = cli_factory.make_lifecycle_environment({ 'organization-id': host.organization.id}) new_cv = cli_factory.make_content_view({ 'organization-id': host.organization.id}) cli_ContentView.publish({'id': new_cv['id']}) version_id = cli_ContentView.version_list({ 'content-view-id': new_cv['id'], })[0]['id'] cli_ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': new_lce['id'], 'organization-id': host.organization.id, }) hostgroup = cli_factory.make_hostgroup({ 'content-view-id': new_cv['id'], 'lifecycle-environment-id': new_lce['id'], 'organization-ids': host.organization.id, }) puppet_proxy = cli_Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] cli_factory.make_host({ 'architecture-id': host.architecture.id, 'domain-id': host.domain.id, 'environment-id': host.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': host.location.id, 'medium-id': host.medium.id, 'name': host.name, 'operatingsystem-id': host.operatingsystem.id, 'organization-id': host.organization.id, 'partition-table-id': host.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with Session(self.browser) as session: set_context(session, host.organization.name, host.location.name) result = self.hosts.fetch_host_parameters( host.name, host.domain.name, [['Host', 'Lifecycle Environment'], ['Host', 'Content View']], ) self.assertEqual(result['Lifecycle Environment'], new_lce['name']) self.assertEqual(result['Content View'], new_cv['name'])
def test_positive_end_to_end(self): """Perform end to end smoke tests using RH repos. 1. Create new organization and environment 2. Upload manifest 3. Sync a RedHat repository 4. Create content-view 5. Add repository to contet-view 6. Promote/publish content-view 7. Create an activation-key 8. Add product to activation-key 9. Create new virtualmachine 10. Pull rpm from Foreman server and install on client 11. Register client with foreman server using activation-key 12. Install rpm on client @Feature: Smoke test @Assert: All tests should succeed and Content should be successfully fetched by client """ # Product, RepoSet and repository variables rhel_product_name = PRDS['rhel'] rhel_repo_set = REPOSET['rhva6'] rhel_repo_name = REPOS['rhva6']['name'] org_name = random.choice(generate_strings_list()) # Create new org and environment new_org = make_org({u'name': org_name}) new_env = make_lifecycle_environment({ u'organization-id': new_org['id'], }) # Clone manifest and upload it with manifests.clone() as manifest: ssh.upload_file(manifest.content, manifest.filename) Subscription.upload({ u'file': manifest.filename, u'organization-id': new_org['id'], }) # Enable repo from Repository Set RepositorySet.enable({ u'basearch': 'x86_64', u'name': rhel_repo_set, u'organization-id': new_org['id'], u'product': rhel_product_name, u'releasever': '6Server', }) # Fetch repository info rhel_repo = Repository.info({ u'name': rhel_repo_name, u'organization-id': new_org['id'], u'product': rhel_product_name, }) # Synchronize the repository Repository.synchronize({ u'name': rhel_repo_name, u'organization-id': new_org['id'], u'product': rhel_product_name, }) # Create CV and associate repo to it new_cv = make_content_view({u'organization-id': new_org['id']}) ContentView.add_repository({ u'id': new_cv['id'], u'organization-id': new_org['id'], u'repository-id': rhel_repo['id'], }) # Publish a version1 of CV ContentView.publish({u'id': new_cv['id']}) # Get the CV info version1_id = ContentView.info({u'id': new_cv['id']})['versions'][0]['id'] # Store the version1 id # Promotion of version1 to next env ContentView.version_promote({ u'id': version1_id, u'to-lifecycle-environment-id': new_env['id'], }) # Create activation key activation_key = make_activation_key({ u'content-view': new_cv['name'], u'lifecycle-environment-id': new_env['id'], u'organization-id': new_org['id'], }) # List the subscriptions in given org result = Subscription.list({u'organization-id': new_org['id']}, per_page=False) self.assertGreater(len(result), 0) # Get the subscription ID from subscriptions list subscription_quantity = 0 for subscription in result: if subscription['name'] == DEFAULT_SUBSCRIPTION_NAME: subscription_id = subscription['id'] subscription_quantity = int(subscription['quantity']) self.assertGreater(subscription_quantity, 0) # Add the subscriptions to activation-key ActivationKey.add_subscription({ u'id': activation_key['id'], u'quantity': 1, u'subscription-id': subscription_id, }) # Enable product content ActivationKey.content_override({ u'content-label': 'rhel-6-server-rhev-agent-rpms', u'id': activation_key['id'], u'organization-id': new_org['id'], u'value': '1', }) # Create VM package_name = "python-kitchen" server_name = settings.server.hostname with VirtualMachine(distro='rhel66') as vm: # Download and Install rpm result = vm.run( "wget -nd -r -l1 --no-parent -A '*.noarch.rpm' http://{0}/pub/" .format(server_name)) self.assertEqual(result.return_code, 0) result = vm.run('rpm -i katello-ca-consumer*.noarch.rpm') self.assertEqual(result.return_code, 0) # Register client with foreman server using activation-key result = vm.run( u'subscription-manager register --activationkey {0} ' '--org {1} --force'.format(activation_key['name'], new_org['label'])) self.assertEqual(result.return_code, 0) # Install contents from sat6 server result = vm.run('yum install -y {0}'.format(package_name)) self.assertEqual(result.return_code, 0) # Verify if package is installed by query it result = vm.run('rpm -q {0}'.format(package_name)) self.assertEqual(result.return_code, 0)
def test_positive_show_count_on_chost_details_page(self): """Errata count on Content host Details page @id: 388229da-2b0b-41aa-a457-9b5ecbf3df4b @Setup: 1. Errata synced on satellite server. 2. Some content hosts are present. @Steps: 1. Go to Hosts -> Content Hosts -> Select Content Host -> Details page. @Assert: 1. The errata section should be displayed with Security, Bugfix, Enhancement types. 2. The number should link to the errata details page, filtered by type. @CaseLevel: System """ org = entities.Organization().create() env = entities.LifecycleEnvironment(organization=org).create() content_view = entities.ContentView(organization=org).create() activation_key = entities.ActivationKey( environment=env, organization=org, ).create() setup_org_for_a_rh_repo({ 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst6'], 'repository': REPOS['rhst6']['name'], 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) setup_org_for_a_custom_repo({ 'url': CUSTOM_REPO_URL, 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) RepositorySet.enable({ 'basearch': DEFAULT_ARCHITECTURE, 'name': REPOSET['rhva6'], 'organization-id': org.id, 'product': PRDS['rhel'], 'releasever': DEFAULT_RELEASE_VERSION, }) rhel_repo = Repository.info({ 'name': REPOS['rhva6']['name'], 'organization-id': org.id, 'product': PRDS['rhel'], }) Repository.synchronize({ 'name': REPOS['rhva6']['name'], 'organization-id': org.id, 'product': PRDS['rhel'], }) ContentView.add_repository({ 'id': content_view.id, 'organization-id': org.id, 'repository-id': rhel_repo['id'], }) ContentView.publish({'id': content_view.id}) cvv = ContentView.info({'id': content_view.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': org.id, 'to-lifecycle-environment-id': env.id, }) with VirtualMachine(distro='rhel67') as client: client.install_katello_ca() result = client.register_contenthost( org.label, activation_key.name, ) self.assertEqual(result.return_code, 0) client.enable_repo(REPOS['rhst6']['id']) client.enable_repo(REPOS['rhva6']['id']) client.install_katello_agent() with Session(self.browser) as session: session.nav.go_to_select_org(org.name) result = self.contenthost.fetch_errata_counts( client.hostname, details_page=True) for errata in ('security', 'bug_fix', 'enhancement'): self.assertEqual(result[errata]['value'], 0) self.assertEqual(result[errata]['color'], 'black') client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) result = self.contenthost.fetch_errata_counts( client.hostname, details_page=True) self.assertEqual(result['security']['value'], 1) self.assertEqual(result['security']['color'], 'red') client.run('yum install -y {0}'.format(REAL_0_RH_PACKAGE)) result = self.contenthost.fetch_errata_counts( client.hostname, details_page=True) for errata in ('bug_fix', 'enhancement'): self.assertEqual(result[errata]['value'], 1) self.assertEqual(result[errata]['color'], 'yellow')
def test_positive_create_with_multiple_entities_name(self): """Check if hostgroup with multiple options name can be created :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created and has all defined entities assigned :BZ: 1395254, 1313056 :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) os_full_name = "{0} {1}.{2}".format( os['name'], os['major-version'], os['minor-version'] ) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'organizations': org['name'], 'locations': loc['name'], 'environment': env['name'], 'lifecycle-environment': lce['name'], 'puppet-proxy': proxy['name'], 'puppet-ca-proxy': proxy['name'], 'content-source-id': proxy['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'query-organization': org['name'] } hostgroup = make_hostgroup(make_hostgroup_params) self.assertIn(org['name'], hostgroup['organizations']) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['puppet-environment']) self.assertEqual(proxy['id'], hostgroup['puppet-master-proxy-id']) self.assertEqual(proxy['id'], hostgroup['puppet-ca-proxy-id']) self.assertEqual(domain['name'], hostgroup['domain']) self.assertEqual(subnet['name'], hostgroup['network']['subnet-ipv4']) self.assertEqual(arch['name'], hostgroup['architecture']) self.assertEqual(ptable['name'], hostgroup['partition-table']) self.assertEqual(media['name'], hostgroup['medium']) self.assertEqual(os_full_name, hostgroup['operating-system']) self.assertEqual(cv['name'], hostgroup['content-view']['name']) self.assertEqual( lce['name'], hostgroup['lifecycle-environment']['name']) self.assertEqual(proxy['name'], hostgroup['content-source']['name'])
def test_positive_errata_status_installable_param(self): """Filter errata for specific content view and verify that host that was registered using that content view has different states in correspondence to filtered errata and `errata status installable` settings flag value :id: ed94cf34-b8b9-4411-8edc-5e210ea6af4f :Steps: 1. Prepare setup: Create Lifecycle Environment, Content View, Activation Key and all necessary repos 2. Register Content Host using created data 3. Create necessary Content View Filter and Rule for repository errata 4. Publish and Promote Content View to a new version and remove old ones. 5. Go to created Host page and check its properties 6. Change 'errata status installable' flag in the settings and check host properties once more :expectedresults: Check that 'errata status installable' flag works as intended :BZ: 1368254 :CaseLevel: System """ env = entities.LifecycleEnvironment( organization=self.session_org).create() content_view = entities.ContentView( organization=self.session_org).create() activation_key = entities.ActivationKey( environment=env, organization=self.session_org, ).create() setup_org_for_a_rh_repo({ 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst7'], 'repository': REPOS['rhst7']['name'], 'organization-id': self.session_org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) custom_entitites = setup_org_for_a_custom_repo({ 'url': CUSTOM_REPO_URL, 'organization-id': self.session_org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) with VirtualMachine(distro=DISTRO_RHEL7) as client: client.install_katello_ca() result = client.register_contenthost( self.session_org.label, activation_key.name, ) self.assertEqual(result.return_code, 0) client.enable_repo(REPOS['rhst7']['id']) client.install_katello_agent() client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) # Adding content view filter and content view filter rule to # exclude errata that we are going to track cvf = make_content_view_filter({ u'content-view-id': content_view.id, u'inclusion': 'false', u'organization-id': self.session_org.id, u'repository-ids': custom_entitites['repository-id'], u'type': 'erratum', }) make_content_view_filter_rule({ u'content-view-id': content_view.id, u'content-view-filter-id': cvf['filter-id'], u'errata-id': CUSTOM_REPO_ERRATA_ID, }) ContentView.publish({u'id': content_view.id}) cvv = ContentView.info({u'id': content_view.id})['versions'][-1] ContentView.version_promote({ u'id': cvv['id'], u'organization-id': self.session_org.id, u'to-lifecycle-environment-id': env.id, }) # Remove old cv versions to have unambiguous one for testing cvvs = ContentView.info({u'id': content_view.id})['versions'] self.assertGreater(len(cvvs), 1) for i in range(len(cvvs) - 1): ContentView.version_delete({u'id': cvvs[i]['id']}) with Session(self.browser) as session: edit_param( session, tab_locator=tab_locators['settings.tab_katello'], param_name='errata_status_installable', param_value='true', ) expected_dict = { 'Status': 'OK', 'Errata': 'All errata applied', 'Subscription': 'Fully entitled', } actual_dict = self.hosts.get_host_properties( client.hostname, expected_dict.keys()) self.assertEqual(expected_dict, actual_dict) edit_param( session, tab_locator=tab_locators['settings.tab_katello'], param_name='errata_status_installable', param_value='false', ) expected_dict = { 'Status': 'Error', 'Errata': 'Security errata applicable', 'Subscription': 'Fully entitled', } actual_dict = self.hosts.get_host_properties( client.hostname, expected_dict.keys()) self.assertEqual(expected_dict, actual_dict)
def test_positive_validate_inherited_cv_lce(session, module_host_template): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI. :id: c83f6819-2649-4a8b-bb1d-ce93b2243765 :expectedresults: Host's lifecycle environment and content view match the ones specified in hostgroup. :CaseLevel: Integration :BZ: 1391656 """ lce = make_lifecycle_environment( {'organization-id': module_host_template.organization.id}) content_view = make_content_view( {'organization-id': module_host_template.organization.id}) ContentView.publish({'id': content_view['id']}) version_id = ContentView.version_list( {'content-view-id': content_view['id']})[0]['id'] ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': lce['id'], 'organization-id': module_host_template.organization.id, }) hostgroup = make_hostgroup({ 'content-view-id': content_view['id'], 'lifecycle-environment-id': lce['id'], 'organization-ids': module_host_template.organization.id, }) puppet_proxy = Proxy.list( {'search': 'name = {0}'.format(settings.server.hostname)})[0] host = make_host({ 'architecture-id': module_host_template.architecture.id, 'domain-id': module_host_template.domain.id, 'environment-id': module_host_template.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': module_host_template.location.id, 'medium-id': module_host_template.medium.id, 'operatingsystem-id': module_host_template.operatingsystem.id, 'organization-id': module_host_template.organization.id, 'partition-table-id': module_host_template.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with session: values = session.host.read(host['name'], ['host.lce', 'host.content_view']) assert values['host']['lce'] == lce['name'] assert values['host']['content_view'] == content_view['name']