Exemplo n.º 1
0
    def test_post_manifest_scenario_refresh(self, request,
                                            dependent_scenario_name):
        """After upgrade, Check the manifest refresh and delete functionality.

        :id: postupgrade-29b246aa-2c7f-49f4-870a-7a0075e184b1

        :steps:
            1. Refresh manifest.
            2. Delete manifest.

        :expectedresults: After upgrade,
            1. Pre-upgrade manifest should be refreshed and deleted.
        """
        pre_test_name = dependent_scenario_name
        org = entities.Organization().search(
            query={'search': f'name={pre_test_name}_org'})[0]
        request.addfinalizer(org.delete)
        sub = entities.Subscription(organization=org)
        sub.refresh_manifest(data={'organization_id': org.id})
        assert len(sub.search()) > 0
        delete_manifest(org.name)
        history = entities.Subscription(organization=org).manifest_history(
            data={'organization_id': org.id})
        assert "Subscriptions deleted by foreman_admin" == history[0][
            'statusMessage']
Exemplo n.º 2
0
def test_post_subscription_scenario_autoattach(request):
    """Run subscription auto-attach on pre-upgrade content host registered
    with Satellite.

    :id: postupgrade-940fc78c-ffa6-4d9a-9c4b-efa1b9480a22

    :steps:
        1. Run subscription auto-attach on content host.
        2. Delete the content host, activation key, location & organization.

    :expectedresults: After upgrade,
        1. Pre-upgrade content host should get subscribed.
        2. All the cleanup should be completed successfully.
    """
    docker_vm = settings.upgrade.docker_vm
    pre_test_name = [
        mark.kwargs['depend_on'].__name__ for mark in request.node.own_markers
        if 'depend_on' in mark.kwargs
    ][0]
    docker_container_name = f'{pre_test_name}' + "_docker_client"
    docker_hostname = execute(
        docker_execute_command,
        docker_container_name,
        'hostname',
        host=docker_vm,
    )[docker_vm]
    org = entities.Organization().search(
        query={'search': f'name="{pre_test_name}_org"'})[0]
    request.addfinalizer(org.delete)
    loc = entities.Location().search(
        query={'search': f'name="{pre_test_name}_loc"'})[0]
    request.addfinalizer(loc.delete)
    act_key = entities.ActivationKey(organization=org).search(
        query={'search': f'name="{pre_test_name}_ak"'})[0]
    request.addfinalizer(act_key.delete)
    host = entities.Host(organization=org).search(
        query={'search': f'name="{docker_hostname.casefold()}"'})[0]
    delete_manifest(org.name)
    request.addfinalizer(host.delete)
    subscription = execute(
        docker_execute_command,
        docker_container_name,
        'subscription-manager attach --auto',
        host=docker_vm,
    )[docker_vm]
    assert 'Subscribed' in subscription
    ssh.command(
        f"docker stop {docker_container_name}; docker rm {docker_container_name}",
        hostname=f'{docker_vm}',
    )
Exemplo n.º 3
0
    def test_post_manifest_scenario_refresh(self):
        """Post-upgrade scenario that verifies manifest refreshed successfully
        and deleted successfully.

        :id: postupgrade-29b246aa-2c7f-49f4-870a-7a0075e184b1

        :steps:
            1. Refresh manifest
            2. Delete manifest

        :expectedresults:
            1. The manifest should refresh and delete successfully.
         """
        org = entities.Organization().search(query={
            'search': 'name={0}'.format(self.org_name)})[0]
        sub = entities.Subscription(organization=org)
        sub.refresh_manifest(data={'organization_id': org.id})
        self.assertGreater(len(sub.search()), 0)
        delete_manifest(self.org_name)
        history = entities.Subscription(organization=org).manifest_history(
            data={'organization_id': org.id})
        self.assertEqual("Subscriptions deleted by foreman_admin",
                         history[0]['statusMessage'])
Exemplo n.º 4
0
    def test_post_manifest_scenario_refresh(self):
        """Post-upgrade scenario that verifies manifest refreshed successfully
        and deleted successfully.

        :id: postupgrade-29b246aa-2c7f-49f4-870a-7a0075e184b1

        :steps:
            1. Refresh manifest
            2. Delete manifest

        :expectedresults:
            1. The manifest should refresh and delete successfully.
         """
        org = entities.Organization().search(
            query={'search': 'name={0}'.format(self.org_name)})[0]
        sub = entities.Subscription(organization=org)
        sub.refresh_manifest(data={'organization_id': org.id})
        self.assertGreater(len(sub.search()), 0)
        delete_manifest(self.org_name)
        history = entities.Subscription(organization=org).manifest_history(
            data={'organization_id': org.id})
        self.assertEqual("Subscriptions deleted by foreman_admin",
                         history[0]['statusMessage'])