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.
This commit is contained in:
Brian C. Lane 2018-10-10 11:30:52 -07:00
parent 3499426b2d
commit 708cadee82
3 changed files with 8 additions and 8 deletions

View File

@ -42,7 +42,7 @@ use_system_repos = False
# will read the above configuration # will read the above configuration
config = configure(conf_file=conf_file, root_dir=self.tmp_dir) 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 # will read composer config and store a dnf config file
self.dbo = get_base_object(config) self.dbo = get_base_object(config)
@ -76,7 +76,7 @@ class DnfbaseSystemReposTest(unittest.TestCase):
# will read the above configuration # will read the above configuration
config = configure(root_dir=self.tmp_dir) 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 # will read composer config and store a dnf config file
self.dbo = get_base_object(config) self.dbo = get_base_object(config)
@ -107,6 +107,6 @@ class CreateDnfDirsTest(unittest.TestCase):
config = configure(test_config=True, root_dir=self.tmp_dir) config = configure(test_config=True, root_dir=self.tmp_dir)
# will create the above directory if missing # 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')) self.assertTrue(os.path.exists(self.tmp_dir + '/var/tmp/composer/dnf/root'))

View File

@ -49,7 +49,7 @@ class ProjectsTest(unittest.TestCase):
def setUpClass(self): def setUpClass(self):
self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.repo.") self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.repo.")
self.config = configure(root_dir=self.tmp_dir, test_config=True) 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) self.dbo = get_base_object(self.config)
os.environ["TZ"] = "UTC" os.environ["TZ"] = "UTC"
time.tzset() time.tzset()

View File

@ -71,11 +71,11 @@ class ServerTestCase(unittest.TestCase):
server.config["COMPOSER_CFG"] = configure(root_dir=repo_dir, test_config=True) server.config["COMPOSER_CFG"] = configure(root_dir=repo_dir, test_config=True)
os.makedirs(joinpaths(server.config["COMPOSER_CFG"].get("composer", "share_dir"), "composer")) 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: if errors:
raise RuntimeError("\n".join(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 # copy over the test dnf repositories
dnf_repo_dir = server.config["COMPOSER_CFG"].get("composer", "repo_dir") 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) server.config["COMPOSER_CFG"] = configure(root_dir=repo_dir, test_config=True)
os.makedirs(joinpaths(server.config["COMPOSER_CFG"].get("composer", "share_dir"), "composer")) 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: if errors:
raise RuntimeError("\n".join(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 # Modify fedora vs. rawhide tests when running on rawhide
if os.path.exists("/etc/yum.repos.d/fedora-rawhide.repo"): if os.path.exists("/etc/yum.repos.d/fedora-rawhide.repo"):