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_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_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 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")
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")
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_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")
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))