summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohan McGovern <rmcgover@redhat.com>2014-11-21 15:55:31 +1000
committerRohan McGovern <rmcgover@redhat.com>2014-12-19 12:29:01 +1000
commit1ac57a8a8fec74a65d30d935d17c18c74f5f5911 (patch)
tree1170a0fbca428ec991adf44ac6fc6b225d4b6a27
parentade083a2e3953f14cb37a93e0adaf9be1e0b204a (diff)
downloadansible-1ac57a8a8fec74a65d30d935d17c18c74f5f5911.tar.gz
test_git: add tests for `refspec' argument
Includes a basic test of the clone and update cases.
-rw-r--r--test/integration/roles/test_git/tasks/main.yml35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/integration/roles/test_git/tasks/main.yml b/test/integration/roles/test_git/tasks/main.yml
index 7e67c82882..4bdc1d8bd8 100644
--- a/test/integration/roles/test_git/tasks/main.yml
+++ b/test/integration/roles/test_git/tasks/main.yml
@@ -206,6 +206,41 @@
that:
- 'git_result.failed'
+# Same as the previous test, but this time we specify which ref
+# contains the SHA1
+- name: update to revision by specifying the refspec
+ git:
+ repo: https://github.com/ansible/ansible-examples.git
+ dest: '{{ checkout_dir }}'
+ version: 2cfde3668b8bb10fbe2b9d5cec486025ad8cc51b
+ refspec: refs/pull/7/merge
+
+- name: check HEAD after update with refspec
+ command: git rev-parse HEAD chdir="{{ checkout_dir }}"
+ register: git_result
+
+- assert:
+ that:
+ - 'git_result.stdout == "2cfde3668b8bb10fbe2b9d5cec486025ad8cc51b"'
+
+- name: clear checkout_dir
+ file: state=absent path={{ checkout_dir }}
+
+- name: clone to revision by specifying the refspec
+ git:
+ repo: https://github.com/ansible/ansible-examples.git
+ dest: '{{ checkout_dir }}'
+ version: 2cfde3668b8bb10fbe2b9d5cec486025ad8cc51b
+ refspec: refs/pull/7/merge
+
+- name: check HEAD after update with refspec
+ command: git rev-parse HEAD chdir="{{ checkout_dir }}"
+ register: git_result
+
+- assert:
+ that:
+ - 'git_result.stdout == "2cfde3668b8bb10fbe2b9d5cec486025ad8cc51b"'
+
#
# Submodule tests
#