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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- git_fetch is failed
|
2017-01-06 23:38:53 +01:00
|
|
|
|
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
|
|
|
|
|
2019-01-25 04:25:06 +01:00
|
|
|
- name: LOCALMODS | get "a" file
|
|
|
|
slurp:
|
|
|
|
src: '{{ checkout_dir }}/a'
|
|
|
|
register: a_file
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | check update arrived
|
2017-01-06 23:38:53 +01:00
|
|
|
assert:
|
|
|
|
that:
|
2019-01-26 04:37:56 +01:00
|
|
|
- "{{ a_file.content | b64decode | trim }} == 2"
|
2017-11-27 23:58:08 +01:00
|
|
|
- git_fetch_force is changed
|
2017-01-06 23:38:53 +01:00
|
|
|
|
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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- git_fetch is failed
|
2017-01-06 23:38:53 +01:00
|
|
|
|
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
|
|
|
|
|
2019-01-25 04:25:06 +01:00
|
|
|
- name: LOCALMODS | get "a" file
|
|
|
|
slurp:
|
|
|
|
src: '{{ checkout_dir }}/a'
|
|
|
|
register: a_file
|
|
|
|
|
2017-10-13 16:30:15 +02:00
|
|
|
- name: LOCALMODS | check update arrived
|
2017-01-06 23:38:53 +01:00
|
|
|
assert:
|
|
|
|
that:
|
2019-01-26 04:37:56 +01:00
|
|
|
- "{{ a_file.content | b64decode | trim }} == 2"
|
2017-11-27 23:58:08 +01:00
|
|
|
- git_fetch_force is changed
|
2017-01-06 23:38:53 +01:00
|
|
|
|
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 }}
|