test_git: add tests for version=<sha1> case
This test covers a recently fixed bug, https://github.com/ansible/ansible-modules-core/issues/313
This commit is contained in:
parent
b07ffbdb5b
commit
be6ef11e96
1 changed files with 46 additions and 0 deletions
|
@ -153,6 +153,52 @@
|
|||
that:
|
||||
- 'git_result.changed'
|
||||
|
||||
# Test that a specific revision can be checked out
|
||||
|
||||
- name: clean out the checkout_dir
|
||||
shell: rm -rf {{ checkout_dir }}/*
|
||||
|
||||
- name: clone to specific revision
|
||||
git: repo={{ repo_format1 }} dest={{ checkout_dir }} version=df4612ba925fbc1b3c51cbb006f51a0443bd2ce9
|
||||
|
||||
- name: check HEAD after clone to revision
|
||||
command: git rev-parse HEAD chdir="{{ checkout_dir }}"
|
||||
register: git_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'git_result.stdout == "df4612ba925fbc1b3c51cbb006f51a0443bd2ce9"'
|
||||
|
||||
- name: update to specific revision
|
||||
git: repo={{ repo_format1 }} dest={{ checkout_dir }} version=4e739a34719654db7b04896966e2354e1256ea5d
|
||||
register: git_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'git_result.changed'
|
||||
|
||||
- name: check HEAD after update to revision
|
||||
command: git rev-parse HEAD chdir="{{ checkout_dir }}"
|
||||
register: git_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'git_result.stdout == "4e739a34719654db7b04896966e2354e1256ea5d"'
|
||||
|
||||
# Test a revision not available under refs/heads/ or refs/tags/
|
||||
|
||||
- name: attempt to get unavailable revision
|
||||
git:
|
||||
repo: https://github.com/ansible/ansible-examples.git
|
||||
dest: '{{ checkout_dir }}'
|
||||
version: 2cfde3668b8bb10fbe2b9d5cec486025ad8cc51b
|
||||
ignore_errors: true
|
||||
register: git_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'git_result.failed'
|
||||
|
||||
#
|
||||
# Submodule tests
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue