2017-01-06 23:38:53 +01:00
|
|
|
# test for https://github.com/ansible/ansible-modules-core/pull/5505
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | prepare old git repo
|
2017-01-06 23:38:53 +01:00
|
|
|
shell: rm -rf localmods; mkdir localmods; cd localmods; git init; echo "1" > a; git add a; git commit -m "1"
|
|
|
|
args:
|
|
|
|
chdir: "{{repo_dir}}"
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | checkout old repo
|
2017-01-06 23:38:53 +01:00
|
|
|
git:
|
|
|
|
repo: '{{ repo_dir }}/localmods'
|
|
|
|
dest: '{{ checkout_dir }}'
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | "update repo"
|
2017-01-06 23:38:53 +01:00
|
|
|
shell: echo "2" > a; git commit -a -m "2"
|
|
|
|
args:
|
|
|
|
chdir: "{{repo_dir}}/localmods"
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | "add local mods"
|
2017-01-06 23:38:53 +01:00
|
|
|
shell: echo "3" > a
|
|
|
|
args:
|
|
|
|
chdir: "{{ checkout_dir }}"
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | fetch with local mods without force (should fail)
|
2017-01-06 23:38:53 +01:00
|
|
|
git:
|
|
|
|
repo: '{{ repo_dir }}/localmods'
|
|
|
|
dest: '{{ checkout_dir }}'
|
|
|
|
register: git_fetch
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | check fetch with localmods failed
|
2017-01-06 23:38:53 +01:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- git_fetch|failed
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | fetch with local mods with force
|
2017-01-06 23:38:53 +01:00
|
|
|
git:
|
|
|
|
repo: '{{ repo_dir }}/localmods'
|
|
|
|
dest: '{{ checkout_dir }}'
|
|
|
|
force: True
|
|
|
|
register: git_fetch_force
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | check update arrived
|
2017-01-06 23:38:53 +01:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "{{ lookup('file', checkout_dir+'/a' )}} == 2"
|
|
|
|
- git_fetch_force|changed
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | clear checkout_dir
|
2017-01-06 23:38:53 +01:00
|
|
|
file: state=absent path={{ checkout_dir }}
|
|
|
|
|
|
|
|
# localmods and shallow clone
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | prepare old git repo
|
2017-01-06 23:38:53 +01:00
|
|
|
shell: rm -rf localmods; mkdir localmods; cd localmods; git init; echo "1" > a; git add a; git commit -m "1"
|
|
|
|
args:
|
|
|
|
chdir: "{{repo_dir}}"
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | checkout old repo
|
2017-01-06 23:38:53 +01:00
|
|
|
git:
|
|
|
|
repo: '{{ repo_dir }}/localmods'
|
|
|
|
dest: '{{ checkout_dir }}'
|
|
|
|
depth: 1
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | "update repo"
|
2017-01-06 23:38:53 +01:00
|
|
|
shell: echo "2" > a; git commit -a -m "2"
|
|
|
|
args:
|
|
|
|
chdir: "{{repo_dir}}/localmods"
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | "add local mods"
|
2017-01-06 23:38:53 +01:00
|
|
|
shell: echo "3" > a
|
|
|
|
args:
|
|
|
|
chdir: "{{ checkout_dir }}"
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | fetch with local mods without force (should fail)
|
2017-01-06 23:38:53 +01:00
|
|
|
git:
|
|
|
|
repo: '{{ repo_dir }}/localmods'
|
|
|
|
dest: '{{ checkout_dir }}'
|
|
|
|
depth: 1
|
|
|
|
register: git_fetch
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | check fetch with localmods failed
|
2017-01-06 23:38:53 +01:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- git_fetch|failed
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | fetch with local mods with force
|
2017-01-06 23:38:53 +01:00
|
|
|
git:
|
|
|
|
repo: '{{ repo_dir }}/localmods'
|
|
|
|
dest: '{{ checkout_dir }}'
|
|
|
|
depth: 1
|
|
|
|
force: True
|
|
|
|
register: git_fetch_force
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | check update arrived
|
2017-01-06 23:38:53 +01:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "{{ lookup('file', checkout_dir+'/a' )}} == 2"
|
|
|
|
- git_fetch_force|changed
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | clear checkout_dir
|
2017-01-06 23:38:53 +01:00
|
|
|
file: state=absent path={{ checkout_dir }}
|