def test_positive_apply_security_erratum(self):
        """Apply security erratum to a host

        :id: 4d1095c8-d354-42ac-af44-adf6dbb46deb

        :expectedresults: erratum is recognized by the
            `yum update --security` command on client

        :CaseLevel: System

        :BZ: 1420671, 1740790
        """
        self.client.download_install_rpm(FAKE_1_YUM_REPO, FAKE_2_CUSTOM_PACKAGE)
        # Check the system is up to date
        result = self.client.run('yum update --security | grep "No packages needed for security"')
        assert result.return_code == 0
        before_downgrade = int(time.time())
        # Downgrade walrus package
        self.client.run(f'yum downgrade -y {FAKE_2_CUSTOM_PACKAGE_NAME}')
        # Wait for errata applicability cache is counted
        wait_for_errata_applicability_task(int(self.host['id']), before_downgrade)
        # Check that host has applicable errata
        host_errata = Host.errata_list({'host-id': self.host['id']})
        assert host_errata[0]['erratum-id'] == FAKE_1_ERRATA_ID
        assert host_errata[0]['installable'] == 'true'
        # Check the erratum becomes available
        result = self.client.run(
            'yum update --assumeno --security | grep "No packages needed for security"'
        )
        assert result.return_code == 1
def test_positive_erratum_installable(vm):
    """Ensure erratum applicability is showing properly, without attaching
    any subscription.

    :id: e8dc52b9-884b-40d7-9244-680b5a736cf7

    :steps:
        1. register a host to unrestricted org with Library
        2. install a package, that will need errata to be applied
        3. list the host applicable errata with searching the required
            errata id

    :expectedresults: errata listed successfuly and is installable

    :BZ: 1344049, 1498158

    :CaseImportance: Critical
    """
    # check that package errata is applicable
    for _ in range(30):
        erratum = Host.errata_list({
            'host': vm.hostname,
            'search': f'id = {REAL_0_ERRATA_ID}'
        })
        if erratum:
            break
        time.sleep(10)
    assert len(erratum) == 1
    assert erratum[0]['installable'] == 'true'
Exemple #3
0
    def test_positive_erratum_installable(self):
        """Ensure erratum applicability is showing properly, without attaching
        any subscription.

        :id: e8dc52b9-884b-40d7-9244-680b5a736cf7

        :CaseAutomation: automated

        :steps:
            1. register a host to unrestricted org with Library
            2. install a package, that will need errata to be applied
            3. list the host applicable errata with searching the required
               errata id

        :expectedresults: errata listed successfully and is installable

        :BZ: 1344049, 1498158

        :CaseImportance: Critical
        """
        with VirtualMachine(distro=DISTRO_RHEL7) as vm:
            self._setup_virtual_machine(vm)
            # install a the packages that has updates with errata
            result = vm.run(
                'yum install -y {0}'.format(REAL_RHEL7_0_0_PACKAGE))
            self.assertEqual(result.return_code, 0)
            result = vm.run('rpm -q {0}'.format(REAL_RHEL7_0_0_PACKAGE))
            self.assertEqual(result.return_code, 0)
            # check that package errata is applicable
            for _ in range(30):
                erratum = Host.errata_list({
                    'host':
                    vm.hostname,
                    'search':
                    'id = {0}'.format(REAL_RHEL7_0_ERRATA_ID)
                })
                if erratum:
                    break
                time.sleep(10)
            self.assertEqual(len(erratum), 1)
            self.assertEqual(erratum[0]['installable'], 'true')
    def test_positive_erratum_installable(self):
        """Ensure erratum applicability is showing properly, without attaching
        any subscription.

        :id: e8dc52b9-884b-40d7-9244-680b5a736cf7

        :CaseAutomation: automated

        :steps:
            1. register a host to unrestricted org with Library
            2. install a package, that will need errata to be applied
            3. list the host applicable errata with searching the required
               errata id

        :expectedresults: errata listed successfully and is installable

        :BZ: 1344049, 1498158

        :CaseImportance: Critical
        """
        with VirtualMachine(distro=DISTRO_RHEL7) as vm:
            self._setup_virtual_machine(vm)
            # install a the packages that has updates with errata
            result = vm.run(
                'yum install -y {0}'.format(REAL_RHEL7_0_0_PACKAGE))
            self.assertEqual(result.return_code, 0)
            result = vm.run('rpm -q {0}'.format(REAL_RHEL7_0_0_PACKAGE))
            self.assertEqual(result.return_code, 0)
            # check that package errata is applicable
            for _ in range(30):
                erratum = Host.errata_list({
                    'host': vm.hostname,
                    'search': 'id = {0}'.format(REAL_RHEL7_0_ERRATA_ID)
                })
                if erratum:
                    break
                time.sleep(10)
            self.assertEqual(len(erratum), 1)
            self.assertEqual(erratum[0]['installable'], 'true')
Exemple #5
0
def test_positive_apply_security_erratum(katello_agent_client):
    """Apply security erratum to a host

    :id: 4d1095c8-d354-42ac-af44-adf6dbb46deb

    :expectedresults: erratum is recognized by the
        `yum update --security` command on client

    :CaseLevel: System

    :customerscenario: true

    :BZ: 1420671, 1740790
    """
    client = katello_agent_client['client']
    host_info = katello_agent_client['host_info']
    client.download_install_rpm(settings.repos.yum_1.url,
                                FAKE_2_CUSTOM_PACKAGE)
    # Check the system is up to date
    result = client.run(
        'yum update --security | grep "No packages needed for security"')
    assert result.status == 0
    before_downgrade = int(time.time())
    # Downgrade walrus package
    client.run(f'yum downgrade -y {FAKE_2_CUSTOM_PACKAGE_NAME}')
    # Wait for errata applicability cache is counted
    wait_for_errata_applicability_task(int(host_info['id']), before_downgrade)
    # Check that host has applicable errata
    host_errata = Host.errata_list({'host-id': host_info['id']})
    assert host_errata[0]['erratum-id'] == settings.repos.yum_0.errata[1]
    assert host_errata[0]['installable'] == 'true'
    # Check the erratum becomes available
    result = client.run(
        'yum update --assumeno --security | grep "No packages needed for security"'
    )
    assert result.status == 1