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))
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)
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))
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)
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)
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)
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)
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,}")
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)
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), [])
def test_03_check_custom_repo_list(): '''check if the repolist contains the 3 custom repos''' nose.tools.eq_(RHUIManagerRepo.list(RHUA), sorted(CUSTOM_REPOS))
def test_01_repo_setup(): '''log in to RHUI, upload cert, check if no repo exists''' RHUIManager.initial_run(RHUA) entlist = RHUIManagerEntitlements.upload_rh_certificate(RHUA) nose.tools.ok_(entlist) nose.tools.ok_(not RHUIManagerRepo.list(RHUA))
def test_16_delete_containers(): '''delete the containers''' Helpers.restore_rhui_tools_conf(RHUA) RHUIManagerRepo.delete_all_repos(RHUA) nose.tools.ok_(not RHUIManagerRepo.list(RHUA))
def test_08_remove_custom_repo(): ''' remove the custom repo ''' RHUIManagerRepo.delete_repo(RHUA, ["custom-enttest"]) nose.tools.assert_equal(RHUIManagerRepo.list(RHUA), [])