コード例 #1
0
    def test_18_repo_select_0():
        '''check if no repo is chosen if 0 is entered when adding a repo'''
        # for RHBZ#1305612
        # upload the small cert and try entering 0 when the list of repos is displayed
        RHUIManagerEntitlements.upload_rh_certificate(
            RHUA, "/tmp/extra_rhui_files/rhcert_atomic.pem")
        RHUIManager.screen(RHUA, "repo")
        Expect.enter(RHUA, "a")
        Expect.expect(RHUA, "Enter value", 180)
        Expect.enter(RHUA, "3")
        Expect.expect(RHUA, "Enter value")
        Expect.enter(RHUA, "0")
        Expect.expect(RHUA, "Enter value")
        Expect.enter(RHUA, "c")
        Expect.expect(RHUA, "Proceed")
        Expect.enter(RHUA, "y")
        Expect.expect(RHUA, "Content")
        Expect.enter(RHUA, "q")

        # the RHUI repo list ought to be empty now; if not, delete the repo and fail
        repo_list = RHUIManagerRepo.list(RHUA)
        RHUIManager.remove_rh_certs(RHUA)
        if repo_list:
            RHUIManagerRepo.delete_all_repos(RHUA)
            raise AssertionError("The repo list is not empty: %s." % repo_list)
コード例 #2
0
 def test_05_upload_packages(self):
     '''
        upload packages to the custom repo
     '''
     RHUIManagerRepo.upload_content(
         RHUA, [self.test["repo_name"]],
         "/tmp/extra_rhui_files/%s" % self.test["repo_id"])
コード例 #3
0
def test_06_display_detailed_info():
    '''
        check detailed information on the repo
    '''
    RHUIManagerRepo.check_detailed_information(RHUA, [REPO, REPO],
                                               [True, True],
                                               [True, "test_gpg_key", False],
                                               3)
コード例 #4
0
 def test_01_setup(self):
     '''log in to rhui-manager, upload RH cert, add a repo to sync '''
     RHUIManager.initial_run(RHUA)
     entlist = RHUIManagerEntitlements.upload_rh_certificate(RHUA)
     nose.tools.assert_not_equal(len(entlist), 0)
     RHUIManagerRepo.add_rh_repo_by_repo(RHUA, [
         Util.format_repo(self.yum_repo_name, self.yum_repo_version,
                          self.yum_repo_kind)
     ])
コード例 #5
0
def test_04_create_custom_repo():
    '''
        add a custom repo using a custom GPG key
    '''
    RHUIManagerRepo.add_custom_repo(
        RHUA,
        REPO,
        redhat_gpg="n",
        custom_gpg="/tmp/extra_rhui_files/test_gpg_key")
コード例 #6
0
 def test_13_add_all_rh_repos():
     '''add all Red Hat repos, remove them (takes a lot of time!)'''
     if not getenv("RHUITESTALLREPOS"):
         raise nose.exc.SkipTest("Not explicitly requested.")
     RHUIManagerRepo.add_rh_repo_all(RHUA)
     # it's not feasible to get the repo list if so many repos are present; skip the check
     #nose.tools.ok_(len(RHUIManagerRepo.list(RHUA)) > 100)
     RHUIManagerRepo.delete_all_repos(RHUA)
     nose.tools.ok_(not RHUIManagerRepo.list(RHUA))
コード例 #7
0
 def test_15_display_container(self):
     '''check detailed information on the RH container'''
     repo_name = Util.safe_pulp_repo_name(self.containers["rh"]["name"])
     RHUIManagerRepo.check_detailed_information(RHUA,
                                                [self.containers["rh"]["displayname"],
                                                 "https://%s/pulp/docker/%s/" % \
                                                 (ConMgr.get_cds_lb_hostname(), repo_name)],
                                                [False],
                                                [True, None, True],
                                                0)
コード例 #8
0
 def test_11_delete_one_repo(self):
     '''remove the Red Hat repo'''
     RHUIManagerRepo.delete_repo(
         RHUA,
         [Util.format_repo(self.yum_repo_name, self.yum_repo_version)])
     repo_list = RHUIManagerRepo.list(RHUA)
     nose.tools.ok_(
         Util.format_repo(self.yum_repo_name,
                          self.yum_repo_version) not in repo_list,
         msg="The repo wasn't removed. Actual repolist: %s" % repo_list)
コード例 #9
0
 def test_09_add_rh_repo_by_repo(self):
     '''add a Red Hat repo by its name'''
     RHUIManagerRepo.add_rh_repo_by_repo(RHUA, [
         Util.format_repo(self.yum_repo_name, self.yum_repo_version,
                          self.yum_repo_kind)
     ])
     repo_list = RHUIManagerRepo.list(RHUA)
     nose.tools.ok_(Util.format_repo(self.yum_repo_name,
                                     self.yum_repo_version) in repo_list,
                    msg="The repo wasn't added. Actual repolist: %s" %
                    repo_list)
コード例 #10
0
 def test_05_display_info(self):
     '''
        check detailed information on the RH container
     '''
     RHUIManagerRepo.check_detailed_information(RHUA,
                                                [self.container_displayname,
                                                 "https://%s/pulp/docker/%s/" % \
                                                 (ConMgr.get_cds_lb_hostname(),
                                                  self.container_id)],
                                                [False],
                                                [True, None, True],
                                                0)
コード例 #11
0
ファイル: test_CLI.py プロジェクト: Skullman/rhui3-automation
 def test_99_cleanup():
     '''Cleanup: Delete all repositories from RHUI (interactively; not currently supported by the CLI), remove certs and other files'''
     RHUIManagerRepo.delete_all_repos(CONNECTION)
     nose.tools.assert_equal(RHUIManagerRepo.list(CONNECTION), [])
     RHUIManager.remove_rh_certs(CONNECTION)
     Expect.ping_pong(CONNECTION, "rm -rf /tmp/atomic_and_my* ; " +
                      "ls /tmp/atomic_and_my* 2>&1",
                      "No such file or directory")
     Expect.ping_pong(CONNECTION, "rm -f /tmp/repos.std{out,err} ; " +
                      "ls /tmp/repos.std{out,err} 2>&1",
                      "No such file or directory")
     rmtree(TMPDIR)
コード例 #12
0
 def test_99_cleanup(self):
     '''
        remove the repo, uninstall hap, cds, cli rpm artefacts; remove rpms from cli
     '''
     Util.remove_rpm(CLI, [self.test["test_package"], self.test["repo_id"]])
     # the errata must be removed in the DB directly:
     Expect.expect_retval(
         RHUA, "mongo pulp_database --eval 'db.units_erratum.remove({})'")
     RHUIManagerRepo.delete_all_repos(RHUA)
     Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % self.test["repo_id"])
     if not getenv("RHUISKIPSETUP"):
         RHUIManagerInstance.delete_all(RHUA, "loadbalancers")
         RHUIManagerInstance.delete_all(RHUA, "cds")
コード例 #13
0
def test_05_upload_to_custom_repo():
    '''
        upload an unsigned and two differently signed packages to the custom repo
    '''
    avail_rpm_names = [
        pkg.rsplit('-', 2)[0]
        for pkg in Util.get_rpms_in_dir(RHUA, CUSTOM_RPMS_DIR)
    ]
    nose.tools.eq_(
        avail_rpm_names,
        sorted([SIGNED_PACKAGE, UNSIGNED_PACKAGE, SIGNED_PACKAGE_SIG2]),
        msg="Failed to find the packages to upload. Got: %s" % avail_rpm_names)
    RHUIManagerRepo.upload_content(RHUA, [REPO], CUSTOM_RPMS_DIR)
コード例 #14
0
 def test_07_check_for_package(self):
     '''check package lists'''
     test_rpm_name = self.custom_rpms[0].rsplit('-', 2)[0]
     nose.tools.eq_(
         RHUIManagerRepo.check_for_package(RHUA, CUSTOM_REPOS[0], ""),
         self.custom_rpms)
     nose.tools.eq_(
         RHUIManagerRepo.check_for_package(RHUA, CUSTOM_REPOS[0],
                                           test_rpm_name),
         [self.custom_rpms[0]])
     nose.tools.eq_(
         RHUIManagerRepo.check_for_package(RHUA, CUSTOM_REPOS[0], "test"),
         [])
     nose.tools.eq_(
         RHUIManagerRepo.check_for_package(RHUA, CUSTOM_REPOS[1], ""), [])
コード例 #15
0
def test_99_cleanup():
    '''
       clean up
    '''
    Util.remove_rpm(CLI, [SIGNED_PACKAGE, "gpg-pubkey-%s" % SIG, REPO])
    rhel = Util.get_rhel_version(CLI)["major"]
    if rhel <= 7:
        cache = "/var/cache/yum/x86_64/%sServer/rhui-custom-%s/" % (rhel, REPO)
    else:
        cache = "/var/cache/dnf/rhui-custom-%s*/" % REPO
    Expect.expect_retval(CLI, "rm -rf %s" % cache)
    RHUIManagerRepo.delete_all_repos(RHUA)
    Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % REPO)
    if not getenv("RHUISKIPSETUP"):
        RHUIManagerInstance.delete_all(RHUA, "loadbalancers")
        RHUIManagerInstance.delete_all(RHUA, "cds")
コード例 #16
0
 def test_99_cleanup(self):
     '''
        remove the repo and RH cert, uninstall CDS and HAProxy, delete the ostree configuration
     '''
     RHUIManagerRepo.delete_all_repos(RHUA)
     nose.tools.assert_equal(RHUIManagerRepo.list(RHUA), [])
     RHUIManagerInstance.delete_all(RHUA, "loadbalancers")
     RHUIManagerInstance.delete_all(RHUA, "cds")
     Expect.expect_retval(RHUA, "rm -f /root/test_atomic_ent_cli*")
     Expect.expect_retval(RHUA, "rm -f /root/test_atomic_pkg.tar.gz")
     RHUIManager.remove_rh_certs(RHUA)
     if AH_EXISTS:
         Expect.expect_retval(
             ATOMIC_CLI,
             "ostree remote delete %s" % self.atomic_repo_remote)
         Expect.expect_retval(
             ATOMIC_CLI, "mv -f /etc/containers/registries.conf{.backup,}")
コード例 #17
0
 def test_99_cleanup(self):
     '''
        remove repos, certs, cli rpms; remove rpms from cli, uninstall cds, hap
     '''
     test_rpm_name = self.custom_rpm.rsplit('-', 2)[0]
     RHUIManagerRepo.delete_all_repos(RHUA)
     nose.tools.assert_equal(RHUIManagerRepo.list(RHUA), [])
     Expect.expect_retval(RHUA, "rm -f /root/test_ent_cli*")
     Expect.expect_retval(RHUA, "rm -rf /root/test_cli_rpm-3.0/")
     Util.remove_rpm(CLI,
                     [self.test_package, "test_cli_rpm", test_rpm_name])
     rmtree(TMPDIR)
     Helpers.del_legacy_ca(CDS, LEGACY_CA_FILE)
     if not getenv("RHUISKIPSETUP"):
         RHUIManagerInstance.delete_all(RHUA, "loadbalancers")
         RHUIManagerInstance.delete_all(RHUA, "cds")
         RHUIManager.remove_rh_certs(RHUA)
コード例 #18
0
 def test_06_start_atomic_repo_sync(self):
     '''
        start syncing the repo
     '''
     atomic_repo_version = RHUIManagerRepo.get_repo_version(
         RHUA, self.atomic_repo_name)
     RHUIManagerSync.sync_repo(
         RHUA,
         [Util.format_repo(self.atomic_repo_name, atomic_repo_version)])
コード例 #19
0
 def test_09_wait_for_sync(self):
     '''
        wait until the repo is synced (takes a while)
     '''
     atomic_repo_version = RHUIManagerRepo.get_repo_version(
         RHUA, self.atomic_repo_name)
     RHUIManagerSync.wait_till_repo_synced(
         RHUA,
         [Util.format_repo(self.atomic_repo_name, atomic_repo_version)])
コード例 #20
0
 def test_99_cleanup(self):
     '''
        remove the containers from the client and the RHUA, uninstall HAProxy and CDS
     '''
     if self.cli_supported:
         Expect.expect_retval(CLI, "docker rm -f $(docker ps -a -f ancestor=%s -q)" % \
                              self.container_id)
         for container in [
                 self.container_id,
                 Util.safe_pulp_repo_name(self.container_quay["name"]),
                 Util.safe_pulp_repo_name(self.container_docker["name"])
         ]:
             Expect.expect_retval(CLI, "docker rmi %s" % container)
         Util.remove_rpm(CLI, [CONF_RPM_NAME])
         Util.restart_if_present(CLI, "docker")
     Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % CONF_RPM_NAME)
     RHUIManagerRepo.delete_all_repos(RHUA)
     if not getenv("RHUISKIPSETUP"):
         RHUIManagerInstance.delete_all(RHUA, "loadbalancers")
         RHUIManagerInstance.delete_all(RHUA, "cds")
コード例 #21
0
 def test_04_add_repo(self):
     '''
        add a custom repo
     '''
     # custom GPG key can have a name, or it can be set to "nokey" (not used with the packages),
     # or it can be undefined altogether, in which case the packages are supposedly signed by RH
     try:
         if self.test["gpg_key"] == "nokey":
             custom_gpg = None
         else:
             custom_gpg = "/tmp/extra_rhui_files/%s/%s" % \
                          (self.test["repo_id"], self.test["gpg_key"])
         redhat_gpg = "n"
     except KeyError:
         custom_gpg = None
         redhat_gpg = "y"
     RHUIManagerRepo.add_custom_repo(RHUA,
                                     self.test["repo_id"],
                                     self.test["repo_name"],
                                     redhat_gpg=redhat_gpg,
                                     custom_gpg=custom_gpg)
コード例 #22
0
 def test_11_sync_again(self):
     '''
        sync the repo again (workaround for RHBZ#1427190)
     '''
     atomic_repo_version = RHUIManagerRepo.get_repo_version(
         RHUA, self.atomic_repo_name)
     RHUIManagerSync.sync_repo(
         RHUA,
         [Util.format_repo(self.atomic_repo_name, atomic_repo_version)])
     RHUIManagerSync.wait_till_repo_synced(
         RHUA,
         [Util.format_repo(self.atomic_repo_name, atomic_repo_version)])
コード例 #23
0
 def test_02_create_3_custom_repos():
     '''create 3 custom repos (protected, unprotected, no RH GPG check) '''
     RHUIManagerRepo.add_custom_repo(RHUA, CUSTOM_REPOS[0], "",
                                     CUSTOM_PATHS[0], "1", "y")
     RHUIManagerRepo.add_custom_repo(RHUA, CUSTOM_REPOS[1], "",
                                     CUSTOM_PATHS[1], "1", "n")
     RHUIManagerRepo.add_custom_repo(RHUA, CUSTOM_REPOS[2], "",
                                     CUSTOM_PATHS[2], "1", "y", "", "n")
コード例 #24
0
 def test_08_display_custom_repos(self):
     '''check detailed information on the custom repos'''
     RHUIManagerRepo.check_detailed_information(
         RHUA, [CUSTOM_REPOS[0], CUSTOM_PATHS[0]], [True, True],
         [True, None, True], len(self.custom_rpms))
     RHUIManagerRepo.check_detailed_information(
         RHUA, [CUSTOM_REPOS[1], CUSTOM_PATHS[1]], [True, False],
         [True, None, True], 0)
     RHUIManagerRepo.check_detailed_information(
         RHUA, [CUSTOM_REPOS[2], CUSTOM_PATHS[2]], [True, True], [False], 0)
コード例 #25
0
 def test_12_add_rh_repo_by_product(self):
     '''add a Red Hat repo by the product that contains it, remove it'''
     RHUIManagerRepo.add_rh_repo_by_product(RHUA, [self.yum_repo_name])
     repo_list = RHUIManagerRepo.list(RHUA)
     nose.tools.ok_(Util.format_repo(self.yum_repo_name,
                                     self.yum_repo_version) in repo_list,
                    msg="The repo wasn't added. Actual repolist: %s" %
                    repo_list)
     RHUIManagerRepo.delete_all_repos(RHUA)
     nose.tools.ok_(not RHUIManagerRepo.list(RHUA))
コード例 #26
0
 def test_05_add_upload_sync_stuff(self):
     '''
        add a custom and RH content repos to protect by a cli entitlement cert, upload rpm, sync
     '''
     RHUIManagerRepo.add_custom_repo(RHUA, CUSTOM_REPO, "", CUSTOM_PATH,
                                     "1", "y")
     RHUIManagerRepo.upload_content(
         RHUA, [CUSTOM_REPO], "%s/%s" % (CUSTOM_RPMS_DIR, self.custom_rpm))
     RHUIManagerRepo.add_rh_repo_by_repo(RHUA, [
         Util.format_repo(self.yum_repo_name, self.yum_repo_version,
                          self.yum_repo_kind)
     ])
     RHUIManagerSync.sync_repo(
         RHUA,
         [Util.format_repo(self.yum_repo_name, self.yum_repo_version)])
コード例 #27
0
 def test_14_add_containers(self):
     '''add containers'''
     # use saved credentials; save them in the RHUI configuration first
     # first a RH container
     Helpers.set_registry_credentials(RHUA)
     RHUIManagerRepo.add_container(RHUA, self.containers["rh"]["name"], "",
                                   self.containers["rh"]["displayname"])
     # then a Quay container
     Helpers.set_registry_credentials(RHUA, "quay", backup=False)
     RHUIManagerRepo.add_container(RHUA,
                                   self.containers["alt"]["quay"]["name"])
     # and finaly a Docker container; we'll need the Docker Hub URL as there's no
     # auth config for it
     url = Helpers.get_registry_url("docker")
     Helpers.set_registry_credentials(RHUA, "docker", [url], backup=False)
     RHUIManagerRepo.add_container(RHUA,
                                   self.containers["alt"]["docker"]["name"])
     # check all of that
     repo_list = RHUIManagerRepo.list(RHUA)
     nose.tools.ok_(
         len(repo_list) == 3,
         msg="The containers weren't added. Actual repolist: %s" %
         repo_list)
コード例 #28
0
 def test_04_add_containers(self):
     '''
        add containers
     '''
     # first, add a container from RH
     # get credentials and enter them when prompted
     credentials = Helpers.get_credentials(RHUA)
     RHUIManagerRepo.add_container(RHUA, self.container_name,
                                   self.container_id,
                                   self.container_displayname,
                                   [""] + credentials)
     # second, add a container from Quay
     # get Quay credentials
     credentials = Helpers.get_credentials(RHUA, "quay")
     quay_url = Helpers.get_registry_url("quay")
     RHUIManagerRepo.add_container(RHUA,
                                   self.container_quay["name"],
                                   credentials=[quay_url] + credentials)
     # third, add a container from the Docker hub
     docker_url = Helpers.get_registry_url("docker")
     RHUIManagerRepo.add_container(RHUA,
                                   self.container_docker["name"],
                                   credentials=[docker_url])
コード例 #29
0
ファイル: test_CLI.py プロジェクト: Skullman/rhui3-automation
 def test_04_create_custom_repo():
     '''Create a custom repo for further testing (interactively; not currently supported by the CLI)'''
     RHUIManagerRepo.add_custom_repo(CONNECTION, CUSTOM_REPO_NAME, entitlement="n")
コード例 #30
0
ファイル: test_CLI.py プロジェクト: Skullman/rhui3-automation
 def test_02_check_empty_repo_list():
     '''Check if the repolist is empty (interactively; not currently supported by the CLI)'''
     nose.tools.assert_equal(RHUIManagerRepo.list(CONNECTION), [])