Пример #1
0
 def setUpClass(cls):
     """Create Directory for all CV Sync Tests in /tmp"""
     super(ContentViewSync, cls).setUpClass()
     cls.exporting_org = make_org()
     cls.exporting_prod = gen_string('alpha')
     product = make_product({
         'organization-id': cls.exporting_org['id'],
         'name': cls.exporting_prod
     })
     cls.exporting_repo = gen_string('alpha')
     repo = make_repository({
         'name': cls.exporting_repo,
         'download-policy': 'immediate',
         'product-id': product['id']
     })
     Repository.synchronize({'id': repo['id']})
     cls.exporting_cv = gen_string('alpha')
     content_view = make_content_view({
         'name': cls.exporting_cv,
         'organization-id': cls.exporting_org['id']
     })
     ContentView.add_repository({
         'id': content_view['id'],
         'organization-id': cls.exporting_org['id'],
         'repository-id': repo['id']
     })
     ContentView.publish({u'id': content_view['id']})
     content_view = ContentView.info({u'id': content_view['id']})
     cls.exporting_cvv_id = content_view['versions'][0]['id']
Пример #2
0
    def test_positive_enable_manifest_reposet(self):
        """enable repository set

        :id: cc0f8f40-5ea6-4fa7-8154-acdc2cb56b45

        :expectedresults: you are able to enable and synchronize repository
            contained in a manifest

        :CaseLevel: Integration

        :CaseImportance: Critical
        """
        self._upload_manifest(self.org['id'])
        Subscription.list(
            {'organization-id': self.org['id']},
            per_page=False,
        )
        RepositorySet.enable({
            'basearch': 'x86_64',
            'name': REPOSET['rhva6'],
            'organization-id': self.org['id'],
            'product': PRDS['rhel'],
            'releasever': '6Server',
        })
        Repository.synchronize({
            'name': REPOS['rhva6']['name'],
            'organization-id': self.org['id'],
            'product': PRDS['rhel'],
        })
Пример #3
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)
Пример #4
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @id: 1d2604fc-8a18-4cbe-bf4c-5c7d9fbdb82c

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
Пример #5
0
    def test_positive_synchronize_auth_yum_repo(self):
        """Check if secured repository can be created and synced

        @id: b0db676b-e0f0-428c-adf3-1d7c0c3599f0

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(
                creds['login'], creds['pass']
            )
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
Пример #6
0
 def setUpClass(cls):
     """Init single organization, product and repository for all tests"""
     super(TestContentViewFilter, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u'organization-id': cls.org['id']})
     cls.repo = make_repository({u'product-id': cls.product['id']})
     Repository.synchronize({u'id': cls.repo['id']})
Пример #7
0
    def test_positive_list_multiple_repos(self):
        """Verify that puppet-modules list for specific repo is correct
        and does not affected by other repositories.

        @id: f36d25b3-2495-4e89-a1cf-e39d52762d95

        @Assert: Number of modules has no changed after a second repo
        was synced.
        """
        # Verify that number of synced modules is correct
        repo1 = Repository.info({'id': self.repo['id']})
        repo_content_count = repo1['content-counts']['puppet-modules']
        modules_num = len(
            PuppetModule.list({'repository-id': repo1['id']}))
        self.assertEqual(repo_content_count, str(modules_num))
        # Create and sync second repo
        repo2 = make_repository({
            u'organization-id': self.org['id'],
            u'product-id': self.product['id'],
            u'content-type': u'puppet',
            u'url': FAKE_1_PUPPET_REPO,
        })
        Repository.synchronize({'id': repo2['id']})
        # Verify that number of modules from the first repo has not changed
        self.assertEqual(
            modules_num,
            len(PuppetModule.list({'repository-id': repo1['id']}))
        )
Пример #8
0
 def setupScenario(self):
     """ Create yum, puppet repositories and synchronize them.
     """
     self.org = make_org({'name': self.org_name})
     self.product = make_product({'name': self.product_name, 'organization-id': self.org['id']})
     self.yum_repo1 = make_repository(
         {
             'name': self.yum_repo1_name,
             'product-id': self.product['id'],
             'content-type': 'yum',
             'url': FAKE_1_YUM_REPO,
         }
     )
     Repository.synchronize({'id': self.yum_repo1['id']})
     self.module = {'name': self.puppet_module_name, 'version': '3.3.3'}
     self.puppet_repo = make_repository(
         {
             'name': self.puppet_repo_name,
             'content-type': 'puppet',
             'product-id': self.product['id'],
             'url': CUSTOM_PUPPET_REPO,
         }
     )
     Repository.synchronize({'id': self.puppet_repo['id']})
     self.puppet_module = PuppetModule.list(
         {'search': 'name={name} and version={version}'.format(**self.module)}
     )[0]
Пример #9
0
    def test_positive_enable_manifest_reposet(self):
        """enable repository set

        @Feature: Subscriptions/Repository Sets

        @Assert: you are able to enable and synchronize
        repository contained in a manifest
        """
        self._upload_manifest(self.org['id'])
        Subscription.list(
            {'organization-id': self.org['id']},
            per_page=False,
        )
        RepositorySet.enable({
            'basearch': 'x86_64',
            'name': REPOSET['rhva6'],
            'organization-id': self.org['id'],
            'product': PRDS['rhel'],
            'releasever': '6Server',
        })
        Repository.synchronize({
            'name': REPOS['rhva6']['name'],
            'organization-id': self.org['id'],
            'product': PRDS['rhel'],
        })
Пример #10
0
    def test_enable_manifest_reposet(self):
        """@Test: enable repository set (positive)

        @Feature: Subscriptions/Repository Sets

        @Assert: you are able to enable and synchronize
        repository contained in a manifest
        """
        self._upload_manifest(self.manifest, self.org['id'])
        Subscription.list(
            {'organization-id': self.org['id']},
            per_page=False,
        )
        RepositorySet.enable({
            'basearch': 'x86_64',
            'name': (
                'Red Hat Enterprise Virtualization Agents '
                'for RHEL 6 Workstation (RPMs)'
            ),
            'organization-id': self.org['id'],
            'product': 'Red Hat Enterprise Linux Workstation',
            'releasever': '6Workstation',
        })
        Repository.synchronize({
            'name': (
                'Red Hat Enterprise Virtualization Agents '
                'for RHEL 6 Workstation '
                'RPMs x86_64 6Workstation'
            ),
            'organization-id': self.org['id'],
            'product': 'Red Hat Enterprise Linux Workstation',
        })
Пример #11
0
    def test_add_synced_docker_repo_to_content_view(self):
        """@Test: Create and sync a Docker-type repository

        @Assert: A repository is created with a Docker repository
        and it is synchronized.

        @Feature: Docker

        """
        repo = _make_docker_repo(
            make_product({'organization-id': self.org_id})['id'])
        Repository.synchronize({'id': repo['id']})
        repo = Repository.info({'id': repo['id']})
        self.assertGreaterEqual(
            int(repo['content-counts']['docker-images']), 1)
        content_view = make_content_view({
            'composite': False,
            'organization-id': self.org_id,
        })
        ContentView.add_repository({
            'id': content_view['id'],
            'repository-id': repo['id'],
        })
        content_view = ContentView.info({'id': content_view['id']})
        self.assertIn(
            repo['id'],
            [repo_['id'] for repo_ in content_view['docker-repositories']],
        )
Пример #12
0
def test_positive_product_sync_state(module_org):
    """hammer product info shows correct sync state.

    :id: 58af6239-85d7-4b8b-bd2d-ab4cd4f29840

    :BZ: 1803207,1999541

    :customerscenario: true

    :Steps:
        1. Sync a custom repository that fails.
        2. Run `hammer product info --product-id <id>`.
        3. Successfully sync another repository under the same product.
        4. Run `hammer product info --product-id <id>` again.


    :expectedresults: hammer should show 'Sync Incomplete' in both cases.
    """
    product = make_product({'organization-id': module_org.id})
    repo_a1 = make_repository({
        'organization-id':
        module_org.id,
        'product-id':
        product['id'],
        'name':
        gen_string('alpha'),
        'url':
        f'{gen_url(scheme="https")}:{gen_integer(min_value=10, max_value=9999)}',
    })

    with pytest.raises(CLIReturnCodeError):
        Repository.synchronize({'id': repo_a1['id']})

    product_info = Product.info({
        'id': product['id'],
        'organization-id': module_org.id
    })
    product_list = Product.list({'organization-id': module_org.id})
    assert product_info['sync-state-(last)'] in [
        p.get('sync-state') for p in product_list
    ]

    repo_a2 = make_repository(
        {
            'organization-id': module_org.id,
            'product-id': product['id'],
            'name': gen_string('alpha'),
            'url': settings.repos.yum_0.url,
        }, )

    Repository.synchronize({'id': repo_a2['id']})
    product_info = Product.info({
        'id': product['id'],
        'organization-id': module_org.id
    })
    product_list = Product.list({'organization-id': module_org.id})
    assert product_info['sync-state-(last)'] in [
        p.get('sync-state') for p in product_list
    ]
Пример #13
0
 def setUpClass(cls):
     """Init single organization, product and repository for all tests"""
     super(TestContentViewFilter, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u"organization-id": cls.org["id"]})
     cls.repo = make_repository({u"product-id": cls.product["id"]})
     Repository.synchronize({u"id": cls.repo["id"]})
     cls.content_view = make_content_view({u"organization-id": cls.org["id"]})
     ContentView.add_repository({u"id": cls.content_view["id"], u"repository-id": cls.repo["id"]})
Пример #14
0
def module_setup(module_org):
    product = make_product({'organization-id': module_org.id})
    repo = make_repository({
        'organization-id': module_org.id,
        'product-id': product['id'],
        'content-type': 'puppet',
        'url': FAKE_0_PUPPET_REPO,
    })
    Repository.synchronize({'id': repo['id']})
    return {'org': module_org, 'product': product, 'repo': repo}
Пример #15
0
 def setUpClass(cls):
     super(PuppetModuleTestCase, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u'organization-id': cls.org['id']})
     cls.repo = make_repository({
         u'organization-id': cls.org['id'],
         u'product-id': cls.product['id'],
         u'content-type': u'puppet',
         u'url': FAKE_0_PUPPET_REPO,
     })
     Repository.synchronize({'id': cls.repo['id']})
Пример #16
0
def golden_ticket_host_setup(request, module_org):
    with manifests.clone(name='golden_ticket') as manifest:
        upload_manifest(module_org.id, manifest.content)
    new_product = make_product({'organization-id': module_org.id})
    new_repo = make_repository({'product-id': new_product['id']})
    Repository.synchronize({'id': new_repo['id']})
    new_ak = make_activation_key({
        'lifecycle-environment': 'Library',
        'content-view': 'Default Organization View',
        'organization-id': module_org.id,
        'auto-attach': False,
    })
    return new_ak
Пример #17
0
 def setUpClass(cls):
     super(PuppetModuleTestCase, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({
         u'organization-id': cls.org['id']
     })
     cls.repo = make_repository({
         u'organization-id': cls.org['id'],
         u'product-id': cls.product['id'],
         u'content-type': u'puppet',
         u'url': FAKE_0_PUPPET_REPO,
     })
     Repository.synchronize({'id': cls.repo['id']})
Пример #18
0
def local_content_view(local_org):
    """Create content view, repository, and product"""
    new_product = make_product({'organization-id': local_org['id']})
    new_repo = make_repository({'product-id': new_product['id']})
    Repository.synchronize({'id': new_repo['id']})
    content_view = make_content_view({'organization-id': local_org['id']})
    ContentView.add_repository({
        'id': content_view['id'],
        'organization-id': local_org['id'],
        'repository-id': new_repo['id'],
    })
    ContentView.publish({'id': content_view['id']})
    return content_view
Пример #19
0
def test_positive_logging_from_pulp3(module_org, default_sat):
    """
    Verify Pulp3 logs are getting captured using pulp3 correlation ID

    :id: 8d5718e6-3442-47d6-b541-0aa78d007e8b

    :CaseLevel: Component

    :CaseImportance: High
    """
    source_log = '/var/log/foreman/production.log'
    test_logfile = '/var/log/messages'

    # Create custom product and repository
    product_name = gen_string('alpha')
    name = product_name
    label = product_name
    desc = product_name
    product = make_product(
        {
            'description': desc,
            'label': label,
            'name': name,
            'organization-id': module_org.id
        }, )
    repo = make_repository(
        {
            'organization-id': module_org.id,
            'product-id': product['id'],
            'url': settings.repos.yum_0.url,
        }, )
    # Synchronize the repository
    Product.synchronize({
        'id': product['id'],
        'organization-id': module_org.id
    })
    Repository.synchronize({'id': repo['id']})
    # Get the id of repository sync from task
    task_out = default_sat.execute(
        "hammer task list | grep -F \'Synchronize repository {\"text\"=>\"repository\'"
    ).stdout.splitlines()[0][:8]
    prod_log_out = default_sat.execute(
        f'grep  {task_out} {source_log}').stdout.splitlines()[0]
    # Get correlation id of pulp from production logs
    pulp_correlation_id = re.search(r'\[I\|bac\|\w{8}\]',
                                    prod_log_out).group()[7:15]
    # verify pulp correlation id in message
    message_log = default_sat.execute(
        f'cat {test_logfile} | grep {pulp_correlation_id}')
    assert message_log.status == 0
Пример #20
0
    def test_positive_install_ansible_collection(self, fixture_sca_vmsetup,
                                                 module_gt_manifest_org):
        """Test whether Ansible collection can be installed via REX

        :Steps:

            1. Upload a manifest.
            2. Enable and sync Ansible repository.
            3. Register content host to Satellite.
            4. Enable Ansible repo on content host.
            5. Install ansible package.
            6. Run REX job to install Ansible collection on content host.

        :id: ad25aee5-4ea3-4743-a301-1c6271856f79

        :CaseComponent: Ansible

        :Assignee: dsynk
        """

        # Configure repository to prepare for installing ansible on host
        RepositorySet.enable({
            'basearch': 'x86_64',
            'name': REPOSET['rhae2'],
            'organization-id': module_gt_manifest_org.id,
            'product': PRDS['rhae'],
            'releasever': '7Server',
        })
        Repository.synchronize({
            'name': REPOS['rhae2']['name'],
            'organization-id': module_gt_manifest_org.id,
            'product': PRDS['rhae'],
        })
        client = fixture_sca_vmsetup
        client.execute(
            f'subscription-manager repos --enable {REPOS["rhae2"]["id"]}')
        client.execute('yum -y install ansible')
        collection_job = make_job_invocation({
            'job-template':
            'Ansible Collection - Install from Galaxy',
            'inputs':
            'ansible_collections_list="oasis_roles.system"',
            'search-query':
            f'name ~ {client.hostname}',
        })
        result = JobInvocation.info({'id': collection_job['id']})
        assert result['success'] == '1'
        collection_path = str(
            client.execute('ls /etc/ansible/collections/ansible_collections'))
        assert 'oasis' in collection_path
Пример #21
0
 def setUpClass(cls):
     """Init single organization, product and repository for all tests"""
     super(ContentViewFilterTestCase, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u'organization-id': cls.org['id']})
     cls.repo = make_repository({u'product-id': cls.product['id']})
     Repository.synchronize({u'id': cls.repo['id']})
     cls.content_view = make_content_view({
         u'organization-id': cls.org['id'],
     })
     ContentView.add_repository({
         u'id': cls.content_view['id'],
         u'repository-id': cls.repo['id'],
     })
Пример #22
0
 def setUpClass(cls):
     """Init single organization, product and repository for all tests"""
     super(ContentViewFilterTestCase, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u'organization-id': cls.org['id']})
     cls.repo = make_repository({u'product-id': cls.product['id']})
     Repository.synchronize({u'id': cls.repo['id']})
     cls.content_view = make_content_view({
         u'organization-id': cls.org['id'],
     })
     ContentView.add_repository({
         u'id': cls.content_view['id'],
         u'repository-id': cls.repo['id'],
     })
 def setUpClass(cls):
     """Init single organization, product and repository for all tests"""
     super().setUpClass()
     cls.org = make_org()
     cls.product = make_product_wait({'organization-id': cls.org['id']})
     cls.content_view = make_content_view(
         {'organization-id': cls.org['id']})
     for _ in range(2):
         cls.repo = make_repository({'product-id': cls.product['id']})
         Repository.synchronize({'id': cls.repo['id']})
         ContentView.add_repository({
             'id': cls.content_view['id'],
             'repository-id': cls.repo['id']
         })
Пример #24
0
    def test_positive_sync(self):
        """Synchronize repository with SRPMs

        @id: eb69f840-122d-4180-b869-1bd37518480c

        @Assert: srpms can be listed in repository
        """
        repo = make_repository({"product-id": self.product["id"], "url": FAKE_YUM_SRPM_REPO})
        Repository.synchronize({"id": repo["id"]})
        result = ssh.command(
            "ls /var/lib/pulp/published/yum/https/repos/{}/Library"
            "/custom/{}/{}/ | grep .src.rpm".format(self.org["label"], self.product["label"], repo["label"])
        )
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #25
0
    def test_positive_sync(self):
        """Synchronize repository with DRPMs

        @id: a645966c-750b-40ef-a264-dc3bb632b9fd

        @Assert: drpms can be listed in repository
        """
        repo = make_repository({"product-id": self.product["id"], "url": FAKE_YUM_DRPM_REPO})
        Repository.synchronize({"id": repo["id"]})
        result = ssh.command(
            "ls /var/lib/pulp/published/yum/https/repos/{}/Library"
            "/custom/{}/{}/drpms/ | grep .drpm".format(self.org["label"], self.product["label"], repo["label"])
        )
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #26
0
    def test_sync_docker_repo(self):
        """@Test: Create and sync a Docker-type repository

        @Assert: A repository is created with a Docker repository
        and it is synchronized.

        @Feature: Docker

        """
        repo = _make_docker_repo(
            make_product({'organization-id': self.org_id})['id'])
        self.assertEqual(int(repo['content-counts']['docker-images']), 0)
        Repository.synchronize({'id': repo['id']})
        repo = Repository.info({'id': repo['id']})
        self.assertGreaterEqual(
            int(repo['content-counts']['docker-images']), 1)
    def repository_single_sync(cls, repo_id, repo_name, thread_id):
        """Single Synchronization

        :param str repo_id: Repository id to be synchronized
        :param str repo_name: Repository name
        :return: time measure for a single sync
        :rtype: float

        """
        LOGGER.info(
            "Synchronize {0} by thread-{1}:"
            .format(repo_name, thread_id)
        )

        result = Repository.synchronize({
            'id': repo_id
        })

        if result.return_code != 0:
            LOGGER.error(
                "Sync repository {0} by thread-{1} failed!"
                .format(repo_name, thread_id)
            )
            return 0
        LOGGER.info(
            "Sync repository {0} by thread-{1} successful!"
            .format(repo_name, thread_id)
        )
        return cls.get_elapsed_time(result.stderr)
Пример #28
0
    def test_positive_synchronize_2(self):
        """@Test: Check if Docker repository can be created and synced

        @Feature: Repository

        @Assert: Docker repository is created and synced

        """

        new_repo = self._make_repository({
            u'name': u'busybox',
            u'url': DOCKER_REGISTRY_HUB,
            u'content-type': u'docker',
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced')

        # Synchronize it
        result = Repository.synchronize({'id': new_repo['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # Verify it has finished
        result = Repository.info({'id': new_repo['id']})
        self.assertEqual(result.stdout['sync']['status'], 'Finished')
Пример #29
0
 def setUpClass(cls):
     """Create an organization, product and ostree repo."""
     super(OstreeBranchTestCase, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u'organization-id': cls.org['id']})
     # Create new custom ostree repo
     cls.ostree_repo = make_repository({
         u'product-id': cls.product['id'],
         u'content-type': u'ostree',
         u'publish-via-http': u'false',
         u'url': FEDORA23_OSTREE_REPO,
     })
     Repository.synchronize({'id': cls.ostree_repo['id']})
     cls.cv = make_content_view({u'organization-id': cls.org['id']})
     ContentView.publish({u'id': cls.cv['id']})
     cls.cv = ContentView.info({u'id': cls.cv['id']})
Пример #30
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @id: 809905ae-fb76-465d-9468-1f99c4274aeb

        @Assert: Repository is created but synchronization fails

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if not cred['http_valid']]:
            url_encoded = url.format(
                creds['login'], creds['pass']
            )
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Try to synchronize it
                repo_sync = Repository.synchronize(
                    {'id': new_repo['id'], u'async': True}
                )
                Task.progress({u'id': repo_sync[0]['id']})
                self.assertEqual(
                    Task.progress({u'id': repo_sync[0]['id']})[0],
                    u'Yum Metadata: Unauthorized'
                )
Пример #31
0
    def test_positive_synchronize_1(self, test_data):
        """@Test: Check if repository can be created and synced

        @Feature: Repository

        @Assert: Repository is created and synced

        """

        new_repo = self._make_repository({
            u'url': test_data['url'],
            u'content-type': test_data['content-type'],
        })
        # Assertion that repo is not yet synced
        self.assertEqual(
            new_repo['sync']['status'],
            'Not Synced',
            "The status of repository should be 'Not Synced'")

        # Synchronize it
        result = Repository.synchronize({'id': new_repo['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Repository was not synchronized")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Verify it has finished
        result = Repository.info({'id': new_repo['id']})
        self.assertEqual(
            result.stdout['sync']['status'],
            'Finished',
            "The new status of repository should be 'Finished'")
Пример #32
0
    def test_positive_synchronize_2(self):
        """@Test: Check if Docker repository can be created and synced

        @Feature: Repository

        @Assert: Docker repository is created and synced

        """

        new_repo = self._make_repository({
            u'name': u'busybox',
            u'url': DOCKER_REGISTRY_HUB,
            u'content-type': u'docker',
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced')

        # Synchronize it
        result = Repository.synchronize({'id': new_repo['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # Verify it has finished
        result = Repository.info({'id': new_repo['id']})
        self.assertEqual(result.stdout['sync']['status'], 'Finished')
Пример #33
0
    def test_positive_synchronize_1(self, test_data):
        """@Test: Check if repository can be created and synced

        @Feature: Repository

        @Assert: Repository is created and synced

        """

        new_repo = self._make_repository({
            u'url':
            test_data['url'],
            u'content-type':
            test_data['content-type'],
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced',
                         "The status of repository should be 'Not Synced'")

        # Synchronize it
        result = Repository.synchronize({'id': new_repo['id']})
        self.assertEqual(result.return_code, 0,
                         "Repository was not synchronized")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Verify it has finished
        result = Repository.info({'id': new_repo['id']})
        self.assertEqual(result.stdout['sync']['status'], 'Finished',
                         "The new status of repository should be 'Finished'")
Пример #34
0
 def setUpClass(cls):
     """Create an organization, product and ostree repo."""
     super(OstreeBranchTestCase, cls).setUpClass()
     cls.org = make_org()
     cls.product = make_product({u'organization-id': cls.org['id']})
     # Create new custom ostree repo
     cls.ostree_repo = make_repository({
         u'product-id': cls.product['id'],
         u'content-type': u'ostree',
         u'publish-via-http': u'false',
         u'url': FEDORA23_OSTREE_REPO,
     })
     Repository.synchronize({'id': cls.ostree_repo['id']})
     cls.cv = make_content_view({u'organization-id': cls.org['id']})
     ContentView.publish({u'id': cls.cv['id']})
     cls.cv = ContentView.info({u'id': cls.cv['id']})
Пример #35
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @id: 809905ae-fb76-465d-9468-1f99c4274aeb

        @Assert: Repository is created but synchronization fails

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [
                cred for cred in valid_http_credentials(url_encoded=True)
                if not cred['http_valid']
        ]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Try to synchronize it
                repo_sync = Repository.synchronize({
                    'id': new_repo['id'],
                    u'async': True
                })
                Task.progress({u'id': repo_sync[0]['id']})
                self.assertEqual(
                    Task.progress({u'id': repo_sync[0]['id']})[0],
                    u'Yum Metadata: Unauthorized')
Пример #36
0
    def test_positive_synchronize_ostree_repo(self):
        """Synchronize ostree repo

        @id: 64fcae0a-44ae-46ae-9938-032bba1331e9

        @Assert: Ostree repository is created and synced

        @CaseLevel: Integration
        """
        new_repo = self._make_repository(
            {u"content-type": u"ostree", u"publish-via-http": u"false", u"url": FEDORA23_OSTREE_REPO}
        )
        # Synchronize it
        Repository.synchronize({"id": new_repo["id"]})
        # Verify it has finished
        new_repo = Repository.info({"id": new_repo["id"]})
        self.assertEqual(new_repo["sync"]["status"], "Success")
Пример #37
0
    def test_positive_export_custom_product(self):
        """Export a repository from the custom product

        :id: 9c855866-b9b1-4e32-b3eb-7342fdaa7116

        :expectedresults: Repository was successfully exported, rpm files are
            present on satellite machine

        :CaseLevel: System
        """
        # Create custom product and repository
        product = make_product({'organization-id': self.org['id']})
        repo = make_repository({
            'download-policy': 'immediate',
            'organization-id': self.org['id'],
            'product-id': product['id'],
        })
        backend_identifier = entities.Repository(
            id=repo['id']).read().backend_identifier
        repo_export_dir = '/mnt/{0}/{1}/{2}/{3}/custom/{4}/{5}'.format(
            self.export_dir,
            backend_identifier,
            self.org['label'],
            ENVIRONMENT,
            product['label'],
            repo['label'],
        )

        # Export the repository
        Repository.export({'id': repo['id']})

        # Verify export directory is empty
        result = ssh.command("find {} -name '*.rpm'".format(repo_export_dir))
        self.assertEqual(len(result.stdout), 0)

        # Synchronize the repository
        Repository.synchronize({'id': repo['id']})

        # Export the repository once again
        Repository.export({'id': repo['id']})

        # Verify RPMs were successfully exported
        result = ssh.command("find {} -name '*.rpm'".format(repo_export_dir))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #38
0
    def test_positive_export_custom_product(self):
        """Export a repository from the custom product

        :id: 9c855866-b9b1-4e32-b3eb-7342fdaa7116

        :expectedresults: Repository was successfully exported, rpm files are
            present on satellite machine

        :CaseLevel: System
        """
        # Create custom product and repository
        product = make_product({'organization-id': self.org['id']})
        repo = make_repository({
            'download-policy': 'immediate',
            'organization-id': self.org['id'],
            'product-id': product['id'],
        })
        backend_identifier = entities.Repository(
            id=repo['id']).read().backend_identifier
        repo_export_dir = '/mnt/{0}/{1}/{2}/{3}/custom/{4}/{5}'.format(
            self.export_dir,
            backend_identifier,
            self.org['label'],
            ENVIRONMENT,
            product['label'],
            repo['label'],
        )

        # Export the repository
        Repository.export({'id': repo['id']})

        # Verify export directory is empty
        result = ssh.command("find {} -name '*.rpm'".format(repo_export_dir))
        self.assertEqual(len(result.stdout), 0)

        # Synchronize the repository
        Repository.synchronize({'id': repo['id']})

        # Export the repository once again
        Repository.export({'id': repo['id']})

        # Verify RPMs were successfully exported
        result = ssh.command("find {} -name '*.rpm'".format(repo_export_dir))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #39
0
    def test_positive_synchronize_ostree_repo(self):
        """Synchronize ostree repo

        @id: 64fcae0a-44ae-46ae-9938-032bba1331e9

        @Assert: Ostree repository is created and synced

        @CaseLevel: Integration
        """
        new_repo = self._make_repository({
            u'content-type': u'ostree',
            u'publish-via-http': u'false',
            u'url': FEDORA23_OSTREE_REPO,
        })
        # Synchronize it
        Repository.synchronize({'id': new_repo['id']})
        # Verify it has finished
        new_repo = Repository.info({'id': new_repo['id']})
        self.assertEqual(new_repo['sync']['status'], 'Success')
Пример #40
0
    def test_positive_synchronize_docker_repo(self):
        """Check if Docker repository can be created and synced

        @Feature: Repository

        @Assert: Docker repository is created and synced
        """
        new_repo = self._make_repository({
            u'content-type': u'docker',
            u'docker-upstream-name': u'busybox',
            u'url': DOCKER_REGISTRY_HUB,
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced')
        # Synchronize it
        Repository.synchronize({'id': new_repo['id']})
        # Verify it has finished
        new_repo = Repository.info({'id': new_repo['id']})
        self.assertEqual(new_repo['sync']['status'], 'Finished')
Пример #41
0
def products_with_repos(orgs):
    """Create and return a list of products. For each product, create and sync a single repo."""
    products = []
    # Create one product for each org, and a second product for the last org.
    for org, params in zip(orgs + orgs[-1:], REPOS_WITH_ERRATA):
        product = entities.Product(organization=org).create()
        # Replace the organization entity returned by create(), which contains only the id,
        # with the one we already have.
        product.organization = org
        products.append(product)
        repo = make_repository({
            'download-policy': 'immediate',
            'organization-id': product.organization.id,
            'product-id': product.id,
            'url': params['url'],
        })
        Repository.synchronize({'id': repo['id']})

    return products
Пример #42
0
    def test_positive_synchronize_yum_repo(self):
        """Check if repository can be created and synced

        @id: e3a62529-edbd-4062-9246-bef5f33bdcf0

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        for url in FAKE_1_YUM_REPO, FAKE_3_YUM_REPO, FAKE_4_YUM_REPO:
            with self.subTest(url):
                new_repo = self._make_repository({u"content-type": u"yum", u"url": url})
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo["sync"]["status"], "Not Synced")
                # Synchronize it
                Repository.synchronize({"id": new_repo["id"]})
                # Verify it has finished
                new_repo = Repository.info({"id": new_repo["id"]})
                self.assertEqual(new_repo["sync"]["status"], "Success")
Пример #43
0
    def test_positive_synchronize_docker_repo(self):
        """Check if Docker repository can be created and synced

        @id: cb9ae788-743c-4785-98b2-6ae0c161bc9a

        @Assert: Docker repository is created and synced

        @CaseLevel: Integration
        """
        new_repo = self._make_repository(
            {u"content-type": u"docker", u"docker-upstream-name": u"busybox", u"url": DOCKER_REGISTRY_HUB}
        )
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo["sync"]["status"], "Not Synced")
        # Synchronize it
        Repository.synchronize({"id": new_repo["id"]})
        # Verify it has finished
        new_repo = Repository.info({"id": new_repo["id"]})
        self.assertEqual(new_repo["sync"]["status"], "Success")
Пример #44
0
    def test_positive_synchronize_docker_repo(self):
        """Check if Docker repository can be created and synced

        @Feature: Repository

        @Assert: Docker repository is created and synced
        """
        new_repo = self._make_repository({
            u'content-type': u'docker',
            u'docker-upstream-name': u'busybox',
            u'url': DOCKER_REGISTRY_HUB,
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced')
        # Synchronize it
        Repository.synchronize({'id': new_repo['id']})
        # Verify it has finished
        new_repo = Repository.info({'id': new_repo['id']})
        self.assertEqual(new_repo['sync']['status'], 'Finished')
Пример #45
0
def ContentHostSetup(request):
    org = make_org()
    with manifests.clone(name='golden_ticket') as manifest:
        upload_manifest(org['id'], manifest.content)
    new_product = make_product({'organization-id': org['id']})
    new_repo = make_repository({'product-id': new_product['id']})
    Repository.synchronize({'id': new_repo['id']})
    new_ak = make_activation_key(
        {
            'lifecycle-environment': 'Library',
            'content-view': 'Default Organization View',
            '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.org_setup = org
    request.cls.ak_setup = new_ak
Пример #46
0
    def test_positive_synchronize_yum_repo(self):
        """Check if repository can be created and synced

        @Feature: Repository

        @Assert: Repository is created and synced
        """
        for url in FAKE_1_YUM_REPO, FAKE_3_YUM_REPO, FAKE_4_YUM_REPO:
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Finished')
Пример #47
0
    def test_positive_synchronize_yum_repo(self):
        """Check if repository can be created and synced

        @Feature: Repository

        @Assert: Repository is created and synced
        """
        for url in FAKE_1_YUM_REPO, FAKE_3_YUM_REPO, FAKE_4_YUM_REPO:
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Finished')
Пример #48
0
    def test_positive_sync(self):
        """Synchronize repository with SRPMs

        @id: eb69f840-122d-4180-b869-1bd37518480c

        @Assert: srpms can be listed in repository
        """
        repo = make_repository({
            'product-id': self.product['id'],
            'url': FAKE_YUM_SRPM_REPO,
        })
        Repository.synchronize({'id': repo['id']})
        result = ssh.command(
            'ls /var/lib/pulp/published/yum/https/repos/{}/Library'
            '/custom/{}/{}/ | grep .src.rpm'.format(
                self.org['label'],
                self.product['label'],
                repo['label'],
            ))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #49
0
    def test_enable_manifest_repository_set(self):
        """@Test: enable repository set (positive)

        @Feature: Subscriptions/Repository Sets

        @Assert: you are able to enable and synchronize
        repository contained in a manifest

        """

        upload_file(self.manifest, remote_file=self.manifest)
        result = Subscription.upload({
            'file': self.manifest,
            'organization-id': self.org['id'],
        })
        self.assertEqual(result.return_code, 0,
                         "Failed to upload manifest")
        self.assertEqual(
            len(result.stderr), 0,
            "There should not be an exception while uploading manifest.")

        result = Subscription.list(
            {'organization-id': self.org['id']},
            per_page=False)
        self.assertEqual(
            len(result.stderr), 0,
            "There should not be an exception while listing the manifest.")

        result = RepositorySet.enable({
            'name': (
                'Red Hat Enterprise Virtualization Agents '
                'for RHEL 6 Workstation (RPMs)'
            ),
            'organization-id': self.org['id'],
            'product': 'Red Hat Enterprise Linux Workstation',
            'releasever': '6Workstation',
            'basearch': 'x86_64',
        })
        self.assertEqual(result.return_code, 0, "Repo was not enabled")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        result = Repository.synchronize({
            'name': (
                'Red Hat Enterprise Virtualization Agents '
                'for RHEL 6 Workstation '
                'RPMs x86_64 6Workstation'
            ),
            'organization-id': self.org['id'],
            'product': 'Red Hat Enterprise Linux Workstation',
        })

        self.assertEqual(result.return_code, 0, "Repo was not synchronized")
        self.assertEqual(len(result.stderr), 0, "No error was expected")
Пример #50
0
    def test_positive_synchronize_docker_repo(self):
        """Check if Docker repository can be created and synced

        @id: cb9ae788-743c-4785-98b2-6ae0c161bc9a

        @Assert: Docker repository is created and synced

        @CaseLevel: Integration
        """
        new_repo = self._make_repository({
            u'content-type': u'docker',
            u'docker-upstream-name': u'busybox',
            u'url': DOCKER_REGISTRY_HUB,
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced')
        # Synchronize it
        Repository.synchronize({'id': new_repo['id']})
        # Verify it has finished
        new_repo = Repository.info({'id': new_repo['id']})
        self.assertEqual(new_repo['sync']['status'], 'Success')
Пример #51
0
    def test_positive_synchronize_docker_repo(self):
        """Check if Docker repository can be created and synced

        @id: cb9ae788-743c-4785-98b2-6ae0c161bc9a

        @Assert: Docker repository is created and synced

        @CaseLevel: Integration
        """
        new_repo = self._make_repository({
            u'content-type': u'docker',
            u'docker-upstream-name': u'busybox',
            u'url': DOCKER_REGISTRY_HUB,
        })
        # Assertion that repo is not yet synced
        self.assertEqual(new_repo['sync']['status'], 'Not Synced')
        # Synchronize it
        Repository.synchronize({'id': new_repo['id']})
        # Verify it has finished
        new_repo = Repository.info({'id': new_repo['id']})
        self.assertEqual(new_repo['sync']['status'], 'Success')
Пример #52
0
    def test_positive_sync_publish_cv(self):
        """Synchronize repository with SRPMs, add repository to content view
        and publish content view

        @id: 78cd6345-9c6c-490a-a44d-2ad64b7e959b

        @Assert: srpms can be listed in content view
        """
        repo = make_repository({"product-id": self.product["id"], "url": FAKE_YUM_SRPM_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"]})
        result = ssh.command(
            "ls /var/lib/pulp/published/yum/https/repos/{}/content_views/{}"
            "/1.0/custom/{}/{}/ | grep .src.rpm".format(
                self.org["label"], cv["label"], self.product["label"], repo["label"]
            )
        )
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #53
0
    def test_positive_sync(self):
        """Synchronize repository with DRPMs

        @id: a645966c-750b-40ef-a264-dc3bb632b9fd

        @Assert: drpms can be listed in repository
        """
        repo = make_repository({
            'product-id': self.product['id'],
            'url': FAKE_YUM_DRPM_REPO,
        })
        Repository.synchronize({'id': repo['id']})
        result = ssh.command(
            'ls /var/lib/pulp/published/yum/https/repos/{}/Library'
            '/custom/{}/{}/drpms/ | grep .drpm'.format(
                self.org['label'],
                self.product['label'],
                repo['label'],
            ))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #54
0
    def test_enable_manifest_repository_set(self):
        """@Test: enable repository set (positive)

        @Feature: Subscriptions/Repository Sets

        @Assert: you are able to enable and synchronize
        repository contained in a manifest

        """

        upload_file(self.manifest, remote_file=self.manifest)
        result = Subscription.upload({
            'file': self.manifest,
            'organization-id': self.org['id'],
        })
        self.assertEqual(result.return_code, 0,
                         "Failed to upload manifest")
        self.assertEqual(
            len(result.stderr), 0,
            "There should not be an exception while uploading manifest.")

        result = Subscription.list(
            {'organization-id': self.org['id']},
            per_page=False)
        self.assertEqual(
            len(result.stderr), 0,
            "There should not be an exception while listing the manifest.")

        result = RepositorySet.enable({
            'name': (
                'Red Hat Enterprise Virtualization Agents '
                'for RHEL 6 Workstation (RPMs)'
            ),
            'organization-id': self.org['id'],
            'product': 'Red Hat Enterprise Linux Workstation',
            'releasever': '6Workstation',
            'basearch': 'x86_64',
        })
        self.assertEqual(result.return_code, 0, "Repo was not enabled")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        result = Repository.synchronize({
            'name': (
                'Red Hat Enterprise Virtualization Agents '
                'for RHEL 6 Workstation '
                'RPMs x86_64 6Workstation'
            ),
            'organization-id': self.org['id'],
            'product': 'Red Hat Enterprise Linux Workstation',
        })

        self.assertEqual(result.return_code, 0, "Repo was not synchronized")
        self.assertEqual(len(result.stderr), 0, "No error was expected")
Пример #55
0
    def test_positive_export_custom_product(self):
        """Export a repository from the custom product

        @Feature: Repository - Export

        @Assert: Repository was successfully exported, rpm files are present on
        satellite machine
        """
        # Create custom product and repository
        product = make_product({'organization-id': self.org['id']})
        repo = make_repository({
            'download-policy': 'immediate',
            'organization-id': self.org['id'],
            'product-id': product['id'],
        })
        repo_export_dir = '/mnt/{0}/{1}-{2}-{3}/{1}/{4}/custom/{2}/{3}'.format(
            self.export_dir,
            self.org['label'],
            product['label'],
            repo['label'],
            ENVIRONMENT,
        )

        # Export the repository
        Repository.export({'id': repo['id']})

        # Verify export directory is empty
        result = ssh.command('ls -l {0} | grep .rpm'.format(repo_export_dir))
        self.assertEqual(len(result.stdout), 0)

        # Synchronize the repository
        Repository.synchronize({'id': repo['id']})

        # Export the repository once again
        Repository.export({'id': repo['id']})

        # Verify RPMs were successfully exported
        result = ssh.command('ls -l {0} | grep .rpm'.format(repo_export_dir))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Пример #56
0
def test_positive_list_filter_by_cve(module_org, rh_repo):
    """Filter errata by CVE

    :id: 7791137c-95a7-4518-a56b-766a5680c5fb

    :Setup: Errata synced on satellite server.

    :Steps: erratum list --cve <cve_id>

    :expectedresults: Errata is filtered by CVE.

    """
    RepositorySet.enable({
        'name': REPOSET['rhva6'],
        'organization-id': module_org.id,
        'product': PRDS['rhel'],
        'releasever': '6Server',
        'basearch': 'x86_64',
    })
    Repository.synchronize({
        'name': REPOS['rhva6']['name'],
        'organization-id': module_org.id,
        'product': PRDS['rhel'],
    })
    repository_info = Repository.info({
        'name': REPOS['rhva6']['name'],
        'organization-id': module_org.id,
        'product': PRDS['rhel'],
    })

    assert REAL_4_ERRATA_ID in {
        errata['errata-id']
        for errata in Erratum.list({'repository-id': repository_info['id']})
    }

    for errata_cve in REAL_4_ERRATA_CVES:
        assert REAL_4_ERRATA_ID in {
            errata['errata-id']
            for errata in Erratum.list({'cve': errata_cve})
        }
Пример #57
0
    def test_positive_synchronize_yum_repo(self):
        """Check if repository can be created and synced

        @id: e3a62529-edbd-4062-9246-bef5f33bdcf0

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        for url in FAKE_1_YUM_REPO, FAKE_3_YUM_REPO, FAKE_4_YUM_REPO:
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
Пример #58
0
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
Пример #59
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)