diff --git a/tests/lib.py b/tests/lib.py index 7462581e..fdff6fb4 100644 --- a/tests/lib.py +++ b/tests/lib.py @@ -100,9 +100,13 @@ def create_git_repo(): for f in ["packages-only.toml", "groups-only.toml"]: shutil.copy2(os.path.join(oldcwd, results_path, f), os.path.join(repodir, "only-bps/")) test_results["second"].append(os.path.join("only-bps/", f)) + + # Add a dotfile as well + open(os.path.join(repodir, "only-bps/.bpsrc"), "w").write("dotfile test\n") + test_results["second"].append("only-bps/.bpsrc") test_results["second"] = sorted(test_results["second"]) - cmd = ["git", "add", "*.toml"] + cmd = ["git", "add", "*.toml", "only-bps/.bpsrc"] subprocess.check_call(cmd) cmd = ["git", "commit", "-m", "second files"] subprocess.check_call(cmd) diff --git a/tests/pylorax/test_gitrpm.py b/tests/pylorax/test_gitrpm.py index 500a34ed..04411b1b 100644 --- a/tests/pylorax/test_gitrpm.py +++ b/tests/pylorax/test_gitrpm.py @@ -157,6 +157,9 @@ class GitRpmTest(unittest.TestCase): files = sorted(f.name for f in rpm.files(hdr) if stat.S_ISREG(f.mode)) self.assertEqual(files, [os.path.join(repo["destination"], f) for f in self.test_results[test_name]]) + # / should never be included in the rpm, doing so conflicts with the filesystem package + self.assertFalse(any(True for f in files if f == "/")) + def git_branch_test(self): """Test creating an rpm from a git branch""" git_repo = toml.loads(""" @@ -246,6 +249,25 @@ class GitRpmTest(unittest.TestCase): finally: shutil.rmtree(temp_dir) + def git_root_test(self): + """Test creating an rpm with / as the destination """ + git_repo = toml.loads(""" + [[repos.git]] + rpmname="git-rpm-test" + rpmversion="1.0.0" + rpmrelease="1" + summary="Testing the git rpm code" + repo="file://%s" + ref="v1.1.0" + destination="/" + """ % (self.repodir)) + try: + rpm_dir = tempfile.mkdtemp(prefix="git-rpm-test.") + rpm_file = make_git_rpm(git_repo["repos"]["git"][0], rpm_dir) + self._check_rpm(git_repo["repos"]["git"][0], rpm_dir, rpm_file, "second") + finally: + shutil.rmtree(rpm_dir) + class GitRpmBuildTest(unittest.TestCase): def get_base_dir_test(self):