diff options
author | Christian Goetze <cgoetze@redbrickhealth.com> | 2013-10-27 18:22:10 -0700 |
---|---|---|
committer | Christian Goetze <Christian.Goetze@appdynamics.com> | 2013-10-31 10:56:14 -0700 |
commit | f41d4ac390eb1d80abe045c2ff2970367a711379 (patch) | |
tree | db8c0125dc87018a923e65aa6080d9870ff5cb85 /test | |
parent | a7121d00aca453e3edad2a8acb14dd9216aad50b (diff) | |
download | ansible-f41d4ac390eb1d80abe045c2ff2970367a711379.tar.gz |
Add support for bare git reference repos
This adds two parameters to the git module:
bare (boolean)
Indicates this is to be a bare repositori
reference (string)
Indicates the path or url to the reference repo.
Check out the "--reference" option in the "git clone"
man page
Added appropriate tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/TestRunner.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/TestRunner.py b/test/TestRunner.py index f991d02bd3..3ae95a071f 100644 --- a/test/TestRunner.py +++ b/test/TestRunner.py @@ -170,10 +170,13 @@ class TestRunner(unittest.TestCase): def test_git(self): self._run('file', ['path=/tmp/gitdemo', 'state=absent']) self._run('file', ['path=/tmp/gd', 'state=absent']) + self._run('file', ['path=/tmp/gdbare', 'state=absent']) + self._run('file', ['path=/tmp/gdreference', 'state=absent']) + self._run('file', ['path=/tmp/gdreftest', 'state=absent']) self._run('command', ['git init gitdemo', 'chdir=/tmp']) self._run('command', ['touch a', 'chdir=/tmp/gitdemo']) self._run('command', ['git add *', 'chdir=/tmp/gitdemo']) - self._run('command', ['git commit -m "test commit 2"', 'chdir=/tmp/gitdemo']) + self._run('command', ['git commit -m "test commit 1"', 'chdir=/tmp/gitdemo']) self._run('command', ['touch b', 'chdir=/tmp/gitdemo']) self._run('command', ['git add *', 'chdir=/tmp/gitdemo']) self._run('command', ['git commit -m "test commit 2"', 'chdir=/tmp/gitdemo']) @@ -186,6 +189,28 @@ class TestRunner(unittest.TestCase): # test the force option when set result = self._run('git', ["repo=\"file:///tmp/gitdemo\"", "dest=/tmp/gd", "force=yes"]) assert result['changed'] + # test the bare option + result = self._run('git', ["repo=\"file:///tmp/gitdemo\"", "dest=/tmp/gdbare", "bare=yes", "remote=test"]) + assert result['changed'] + # test a no-op fetch + result = self._run('git', ["repo=\"file:///tmp/gitdemo\"", "dest=/tmp/gdbare", "bare=yes"]) + assert not result['changed'] + # test whether fetch is working for bare repos + self._run('command', ['touch c', 'chdir=/tmp/gitdemo']) + self._run('command', ['git add *', 'chdir=/tmp/gitdemo']) + self._run('command', ['git commit -m "test commit 3"', 'chdir=/tmp/gitdemo']) + result = self._run('git', ["repo=\"file:///tmp/gitdemo\"", "dest=/tmp/gdbare", "bare=yes"]) + assert result['changed'] + # test reference repos + result = self._run('git', ["repo=\"file:///tmp/gdbare\"", "dest=/tmp/gdreference", "bare=yes"]) + assert result['changed'] + result = self._run('git', ["repo=\"file:///tmp/gitdemo\"", "dest=/tmp/gdreftest", "reference=/tmp/gdreference/"]) + assert result['changed'] + assert os.path.isfile('/tmp/gdreftest/a') + result = self._run('command', ['ls', 'chdir=/tmp/gdreference/objects/pack']) + assert result['stdout'] != '' + result = self._run('command', ['ls', 'chdir=/tmp/gdreftest/.git/objects/pack']) + assert result['stdout'] == '' def test_file(self): filedemo = tempfile.mkstemp()[1] |