mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
4fe08441be
* Warn on tests used as filters * Update docs, add aliases for tests that fit more gramatically with test syntax * Fix rst formatting * Add successful filter, alias of success * Remove renamed_deprecation, it was overkill * Make directory alias for is_dir * Update tests to use proper jinja test syntax * Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax * Add conversion script, porting guide updates, and changelog updates * Update newly added uses of tests as filters * No underscore variable * Convert recent tests as filter changes to win_stat * Fix some changes related to rebasing a few integration tests * Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name * Add test for tests_as_filters_warning * Update tests as filters in newly added/modified tests * Address recent changes to several integration tests * Address recent changes in cs_vpc
173 lines
4.3 KiB
YAML
173 lines
4.3 KiB
YAML
# Test the depth option and fetching revisions that were ignored first
|
|
|
|
- name: DEPTH | clear checkout_dir
|
|
file:
|
|
state: absent
|
|
path: "{{ checkout_dir }}"
|
|
|
|
- name: DEPTH | Clone example git repo with depth 1
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
|
|
- name: DEPTH | try to access earlier commit
|
|
command: "git checkout {{git_shallow_head_1.stdout}}"
|
|
register: checkout_early
|
|
failed_when: False
|
|
args:
|
|
chdir: '{{ checkout_dir }}'
|
|
|
|
- name: DEPTH | make sure the old commit was not fetched
|
|
assert:
|
|
that: 'checkout_early.rc != 0'
|
|
when: git_version.stdout is version(git_version_supporting_depth, '>=')
|
|
|
|
# tests https://github.com/ansible/ansible/issues/14954
|
|
- name: DEPTH | fetch repo again with depth=1
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
register: checkout2
|
|
|
|
- assert:
|
|
that: "checkout2 is not changed"
|
|
when: git_version.stdout is version(git_version_supporting_depth, '>=')
|
|
|
|
- name: DEPTH | again try to access earlier commit
|
|
shell: "git checkout {{git_shallow_head_1.stdout}}"
|
|
register: checkout_early
|
|
failed_when: False
|
|
args:
|
|
chdir: '{{ checkout_dir }}'
|
|
|
|
- name: DEPTH | again make sure the old commit was not fetched
|
|
assert:
|
|
that: 'checkout_early.rc != 0'
|
|
when: git_version.stdout is version(git_version_supporting_depth, '>=')
|
|
|
|
# make sure we are still able to fetch other versions
|
|
- name: DEPTH | Clone same repo with older version
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
version: earlytag
|
|
register: cloneold
|
|
|
|
- assert:
|
|
that: cloneold is successful
|
|
|
|
- name: DEPTH | try to access earlier commit
|
|
shell: "git checkout {{git_shallow_head_1.stdout}}"
|
|
args:
|
|
chdir: '{{ checkout_dir }}'
|
|
|
|
- name: DEPTH | clear checkout_dir
|
|
file:
|
|
state: absent
|
|
path: "{{ checkout_dir }}"
|
|
|
|
# Test for https://github.com/ansible/ansible/issues/21316
|
|
- name: DEPTH | Shallow clone with tag
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
version: earlytag
|
|
register: cloneold
|
|
|
|
- assert:
|
|
that: cloneold is successful
|
|
|
|
- name: DEPTH | clear checkout_dir
|
|
file:
|
|
state: absent
|
|
path: "{{ checkout_dir }}"
|
|
|
|
|
|
# Test for https://github.com/ansible/ansible-modules-core/issues/3456
|
|
# clone a repo with depth and version specified
|
|
|
|
- name: DEPTH | clone repo with both version and depth specified
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
version: master
|
|
|
|
- name: DEPTH | run a second time (now fetch, not clone)
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
version: master
|
|
register: git_fetch
|
|
|
|
- name: DEPTH | ensure the fetch succeeded
|
|
assert:
|
|
that: git_fetch is successful
|
|
|
|
|
|
- name: DEPTH | clear checkout_dir
|
|
file:
|
|
state: absent
|
|
path: "{{ checkout_dir }}"
|
|
|
|
- name: DEPTH | clone repo with both version and depth specified
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
version: master
|
|
|
|
- name: DEPTH | switch to older branch with depth=1 (uses fetch)
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
version: earlybranch
|
|
register: git_fetch
|
|
|
|
- name: DEPTH | ensure the fetch succeeded
|
|
assert:
|
|
that: git_fetch is successful
|
|
|
|
- name: DEPTH | clear checkout_dir
|
|
file:
|
|
state: absent
|
|
path: "{{ checkout_dir }}"
|
|
|
|
# test for https://github.com/ansible/ansible-modules-core/issues/3782
|
|
# make sure shallow fetch works when no version is specified
|
|
|
|
- name: DEPTH | checkout old repo
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
|
|
- name: DEPTH | "update repo"
|
|
shell: echo "3" > a; git commit -a -m "3"
|
|
args:
|
|
chdir: "{{ repo_dir }}/shallow"
|
|
|
|
- name: DEPTH | fetch updated repo
|
|
git:
|
|
repo: 'file://{{ repo_dir|expanduser }}/shallow'
|
|
dest: '{{ checkout_dir }}'
|
|
depth: 1
|
|
register: git_fetch
|
|
ignore_errors: yes
|
|
|
|
- name: DEPTH | check update arrived
|
|
assert:
|
|
that:
|
|
- "{{ lookup('file', checkout_dir+'/a' )}} == 3"
|
|
- git_fetch is changed
|
|
|
|
- name: DEPTH | clear checkout_dir
|
|
file:
|
|
state: absent
|
|
path: "{{ checkout_dir }}"
|