Merge pull request #48883 from terminalmage/salt-jenkins-1023

Fix failing git worktree tests
This commit is contained in:
Nicole Thomas 2018-08-02 12:51:39 -04:00 committed by GitHub
commit 0ca0b6f2f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -619,8 +619,6 @@ class GitModuleTest(ModuleCase):
shutil.rmtree(new_repo)
# Test for git.is_worktree is in test_worktree_add_rm
def test_list_branches(self):
'''
Test git.list_branches
@ -943,6 +941,7 @@ class GitModuleTest(ModuleCase):
worktree_path = tempfile.mkdtemp(dir=TMP)
worktree_basename = os.path.basename(worktree_path)
worktree_path2 = tempfile.mkdtemp(dir=TMP)
worktree_basename2 = os.path.basename(worktree_path2)
# Even though this is Windows, git commands return a unix style path
if salt.utils.is_windows():
@ -953,11 +952,13 @@ class GitModuleTest(ModuleCase):
ret = self.run_function(
'git.worktree_add', [self.repo, worktree_path],
)
self.assertTrue(worktree_add_prefix + worktree_path in ret)
self.assertTrue(worktree_add_prefix in ret)
self.assertTrue(worktree_basename in ret)
ret = self.run_function(
'git.worktree_add', [self.repo, worktree_path2]
)
self.assertTrue(worktree_add_prefix + worktree_path2 in ret)
self.assertTrue(worktree_add_prefix in ret)
self.assertTrue(worktree_basename2 in ret)
# Check if this new path is a worktree
self.assertTrue(self.run_function('git.is_worktree', [worktree_path]))
# Check if the main repo is a worktree