def test_positive_install_package(self): """Install a package to a host remotely :id: b1009bba-0c7e-4b00-8ac4-256e5cfe4a78 :expectedresults: Package was successfully installed :CaseLevel: System """ Host.package_install({'host-id': self.host['id'], 'packages': FAKE_0_CUSTOM_PACKAGE_NAME}) result = self.client.run(f'rpm -q {FAKE_0_CUSTOM_PACKAGE_NAME}') assert result.return_code == 0
def test_positive_install_package(self): """Install a package to a host remotely @Feature: Host - Package @Assert: Package was successfully installed """ Host.package_install({ u'host-id': self.host['id'], u'packages': FAKE_0_CUSTOM_PACKAGE_NAME, }) result = self.client.run( 'rpm -q {0}'.format(FAKE_0_CUSTOM_PACKAGE_NAME)) self.assertEqual(result.return_code, 0)
def test_positive_install_package(self): """Install a package to a host remotely @Feature: Host - Package @Assert: Package was successfully installed """ Host.package_install({ u'host-id': self.host['id'], u'packages': FAKE_0_CUSTOM_PACKAGE_NAME, }) result = self.client.run( 'rpm -q {0}'.format(FAKE_0_CUSTOM_PACKAGE_NAME) ) self.assertEqual(result.return_code, 0)
def test_positive_install_package(self): """Install a package to a host remotely @id: b1009bba-0c7e-4b00-8ac4-256e5cfe4a78 @Assert: Package was successfully installed @CaseLevel: System """ Host.package_install({ u'host-id': self.host['id'], u'packages': FAKE_0_CUSTOM_PACKAGE_NAME, }) result = self.client.run( 'rpm -q {0}'.format(FAKE_0_CUSTOM_PACKAGE_NAME)) self.assertEqual(result.return_code, 0)
def test_positive_install_package(katello_agent_client): """Install a package to a host remotely :id: b1009bba-0c7e-4b00-8ac4-256e5cfe4a78 :expectedresults: Package was successfully installed :CaseLevel: System """ client = katello_agent_client['client'] host_info = katello_agent_client['host_info'] Host.package_install({ 'host-id': host_info['id'], 'packages': FAKE_0_CUSTOM_PACKAGE_NAME }) result = client.run(f'rpm -q {FAKE_0_CUSTOM_PACKAGE_NAME}') assert result.status == 0
def test_positive_install_package(self): """Install a package to a host remotely @id: b1009bba-0c7e-4b00-8ac4-256e5cfe4a78 @Assert: Package was successfully installed @CaseLevel: System """ Host.package_install({ u'host-id': self.host['id'], u'packages': FAKE_0_CUSTOM_PACKAGE_NAME, }) result = self.client.run( 'rpm -q {0}'.format(FAKE_0_CUSTOM_PACKAGE_NAME) ) self.assertEqual(result.return_code, 0)
def test_positive_generate_hostpkgcompare(local_org, local_ak, local_content_view, local_environment): """Generate 'Host - compare content hosts packages' report :id: 572fb387-86f2-40e2-b2df-e8ec26433610 :setup: Installed Satellite with Organization, Activation key, Content View, Content Host, Subscriptions, and synced fake repo. :steps: 1. hammer report-template generate --name 'Host - compare content hosts package' ... :expectedresults: report is scheduled and generated containing all the expected information regarding host packages :CaseImportance: Medium :BZ: 1860430 """ # Add subscription to Satellite Tools repo to activation key setup_org_for_a_rh_repo({ 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst7'], 'repository': REPOS['rhst7']['name'], 'organization-id': local_org['id'], 'content-view-id': local_content_view['id'], 'lifecycle-environment-id': local_environment['id'], 'activationkey-id': local_ak['id'], }) setup_org_for_a_custom_repo({ 'url': FAKE_6_YUM_REPO, 'organization-id': local_org['id'], 'content-view-id': local_content_view['id'], 'lifecycle-environment-id': local_environment['id'], 'activationkey-id': local_ak['id'], }) hosts_info = [] with VMBroker(nick='rhel7', host_classes={'host': ContentHost}, _count=2) as hosts: for client in hosts: # Create RHEL hosts via broker and register content host client.install_katello_ca() # Register content host, install katello-agent client.register_contenthost(local_org['label'], local_ak['name']) assert client.subscribed hosts_info.append(Host.info({'name': client.hostname})) client.enable_repo(REPOS['rhst7']['id']) client.install_katello_agent() hosts_info.sort(key=lambda host: host['name']) host1, host2 = hosts_info Host.package_install({ 'host-id': host1['id'], 'packages': FAKE_0_CUSTOM_PACKAGE_NAME }) Host.package_install({ 'host-id': host1['id'], 'packages': FAKE_1_CUSTOM_PACKAGE }) Host.package_install({ 'host-id': host2['id'], 'packages': FAKE_2_CUSTOM_PACKAGE }) result = ReportTemplate.generate({ 'name': 'Host - compare content hosts packages', 'inputs': f'Host 1 = {host1["name"]}, ' f'Host 2 = {host2["name"]}', }) result.remove('') assert len(result) > 1 headers = f'Package,{host1["name"]},{host2["name"]},Architecture,Status' assert headers == result[0] items = [item.split(',') for item in result[1:]] assert len(items) for item in items: assert len(item) == 5 name, host1version, host2version, arch, status = item assert len(name) assert ((host1version == '-' and name in host2version) or (name in host1version and host2version == '-') or (name in host1version and name in host2version)) assert arch in [ 'x86_64', 'i686', 's390x', 'ppc64', 'ppc64le', 'noarch' ] assert status in ( 'same version', f'{host1["name"]} only', f'{host2["name"]} only', f'lower in {host1["name"]}', f'greater in {host1["name"]}', ) # test for specific installed packages if name == FAKE_0_CUSTOM_PACKAGE_NAME: assert status == f'{host1["name"]} only' if name == FAKE_1_CUSTOM_PACKAGE_NAME: assert (status == f'lower in {host1["name"]}' or status == f'greater in {host2["name"]}')
def test_positive_generate_hostpkgcompare(self): """Generate 'Host - compare content hosts packages' report :id: 572fb387-86f2-40e2-b2df-e8ec26433610 :setup: Installed Satellite with Organization, Activation key, Content View, Content Host, Subscriptions, and synced fake repo. :steps: 1. hammer report-template generate --name 'Host - compare content hosts package' ... :expectedresults: report is scheduled and generated containing all the expected information regarding host packages :CaseImportance: Medium :BZ: 1860430 """ # Add subscription to Satellite Tools repo to activation key setup_org_for_a_rh_repo( { 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst7'], 'repository': REPOS['rhst7']['name'], 'organization-id': self.setup_org['id'], 'content-view-id': self.setup_content_view['id'], 'lifecycle-environment-id': self.setup_env['id'], 'activationkey-id': self.setup_new_ak['id'], } ) hosts = [] for i in [0, 1]: # Create VM and register content host client = VirtualMachine(distro=DISTRO_RHEL7) client.create() self.addCleanup(vm_cleanup, client) client.install_katello_ca() # Register content host, install katello-agent client.register_contenthost(self.setup_org['label'], self.setup_new_ak['name']) self.assertTrue(client.subscribed) hosts.append(Host.info({'name': client.hostname})) client.enable_repo(REPOS['rhst7']['id']) client.install_katello_agent() hosts.sort(key=lambda host: host['name']) host1, host2 = hosts Host.package_install({'host-id': host1['id'], 'packages': FAKE_0_CUSTOM_PACKAGE_NAME}) Host.package_install({'host-id': host1['id'], 'packages': FAKE_1_CUSTOM_PACKAGE}) Host.package_install({'host-id': host2['id'], 'packages': FAKE_2_CUSTOM_PACKAGE}) result = ReportTemplate.generate( { 'name': 'Host - compare content hosts packages', 'inputs': f"Host 1 = {host1['name']}, " f"Host 2 = {host2['name']}", } ) result.remove('') self.assertGreater(len(result), 1) headers = f'Package,{host1["name"]},{host2["name"]},Architecture,Status' self.assertEqual(headers, result[0]) items = [item.split(',') for item in result[1:]] self.assertGreater(len(items), 0) for item in items: self.assertEqual(len(item), 5) name, host1version, host2version, arch, status = item self.assertGreater(len(name), 0) assert ( (host1version == '-' and name in host2version) or (name in host1version and host2version == '-') or (name in host1version and name in host2version) ) self.assertIn(arch, ['x86_64', 'i686', 's390x', 'ppc64', 'ppc64le', 'noarch']) assert status in ( 'same version', f'{host1["name"]} only', f'{host2["name"]} only', f'lower in {host1["name"]}', f'greater in {host1["name"]}', ) # test for specific installed packages if name == FAKE_0_CUSTOM_PACKAGE_NAME: assert status == f'{host1["name"]} only' if name == FAKE_1_CUSTOM_PACKAGE_NAME: assert ( status == f'lower in {host1["name"]}' or status == f'greater in {host2["name"]}' )