From 1a7b6c74b4ad53d9a7a3904f9ae98da1393e5c04 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 10 Oct 2018 11:30:52 -0700 Subject: [PATCH] Update the tests for new make_dnf_dir arguments. Use the uid and gid that the test is running as instead of hard-coding 0. --- tests/pylorax/test_dnfbase.py | 6 +++--- tests/pylorax/test_projects.py | 2 +- tests/pylorax/test_server.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/pylorax/test_dnfbase.py b/tests/pylorax/test_dnfbase.py index e32978cb..bfc19fa2 100644 --- a/tests/pylorax/test_dnfbase.py +++ b/tests/pylorax/test_dnfbase.py @@ -42,7 +42,7 @@ use_system_repos = False # will read the above configuration config = configure(conf_file=conf_file, root_dir=self.tmp_dir) - make_dnf_dirs(config) + make_dnf_dirs(config, os.getuid(), os.getgid()) # will read composer config and store a dnf config file self.dbo = get_base_object(config) @@ -76,7 +76,7 @@ class DnfbaseSystemReposTest(unittest.TestCase): # will read the above configuration config = configure(root_dir=self.tmp_dir) - make_dnf_dirs(config) + make_dnf_dirs(config, os.getuid(), os.getgid()) # will read composer config and store a dnf config file self.dbo = get_base_object(config) @@ -107,6 +107,6 @@ class CreateDnfDirsTest(unittest.TestCase): config = configure(test_config=True, root_dir=self.tmp_dir) # will create the above directory if missing - make_dnf_dirs(config) + make_dnf_dirs(config, os.getuid(), os.getgid()) self.assertTrue(os.path.exists(self.tmp_dir + '/var/tmp/composer/dnf/root')) diff --git a/tests/pylorax/test_projects.py b/tests/pylorax/test_projects.py index cca23a56..94de68b5 100644 --- a/tests/pylorax/test_projects.py +++ b/tests/pylorax/test_projects.py @@ -49,7 +49,7 @@ class ProjectsTest(unittest.TestCase): def setUpClass(self): self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.repo.") self.config = configure(root_dir=self.tmp_dir, test_config=True) - make_dnf_dirs(self.config) + make_dnf_dirs(self.config, os.getuid(), os.getgid()) self.dbo = get_base_object(self.config) os.environ["TZ"] = "UTC" time.tzset() diff --git a/tests/pylorax/test_server.py b/tests/pylorax/test_server.py index 6657cd9e..7ea6f703 100644 --- a/tests/pylorax/test_server.py +++ b/tests/pylorax/test_server.py @@ -71,11 +71,11 @@ class ServerTestCase(unittest.TestCase): server.config["COMPOSER_CFG"] = configure(root_dir=repo_dir, test_config=True) os.makedirs(joinpaths(server.config["COMPOSER_CFG"].get("composer", "share_dir"), "composer")) - errors = make_queue_dirs(server.config["COMPOSER_CFG"], 0) + errors = make_queue_dirs(server.config["COMPOSER_CFG"], os.getgid()) if errors: raise RuntimeError("\n".join(errors)) - make_dnf_dirs(server.config["COMPOSER_CFG"]) + make_dnf_dirs(server.config["COMPOSER_CFG"], os.getuid(), os.getgid()) # copy over the test dnf repositories dnf_repo_dir = server.config["COMPOSER_CFG"].get("composer", "repo_dir") @@ -1397,11 +1397,11 @@ class RepoCacheTestCase(unittest.TestCase): server.config["COMPOSER_CFG"] = configure(root_dir=repo_dir, test_config=True) os.makedirs(joinpaths(server.config["COMPOSER_CFG"].get("composer", "share_dir"), "composer")) - errors = make_queue_dirs(server.config["COMPOSER_CFG"], 0) + errors = make_queue_dirs(server.config["COMPOSER_CFG"], os.getgid()) if errors: raise RuntimeError("\n".join(errors)) - make_dnf_dirs(server.config["COMPOSER_CFG"]) + make_dnf_dirs(server.config["COMPOSER_CFG"], os.getuid(), os.getgid()) # Modify fedora vs. rawhide tests when running on rawhide if os.path.exists("/etc/yum.repos.d/fedora-rawhide.repo"):