diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/git/tasks/single-branch.yml | |
parent | Initial commit. (diff) | |
download | ansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/git/tasks/single-branch.yml')
-rw-r--r-- | test/integration/targets/git/tasks/single-branch.yml | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/integration/targets/git/tasks/single-branch.yml b/test/integration/targets/git/tasks/single-branch.yml new file mode 100644 index 0000000..5cfb4d5 --- /dev/null +++ b/test/integration/targets/git/tasks/single-branch.yml @@ -0,0 +1,87 @@ +# Test single_branch parameter + +- name: SINGLE_BRANCH | clear checkout_dir + file: + state: absent + path: "{{ checkout_dir }}" + +- name: SINGLE_BRANCH | Clone example git repo using single_branch + git: + repo: 'file://{{ repo_dir|expanduser }}/shallow_branches' + dest: '{{ checkout_dir }}' + single_branch: yes + register: single_branch_1 + +- name: SINGLE_BRANCH | Clone example git repo using single_branch again + git: + repo: 'file://{{ repo_dir|expanduser }}/shallow_branches' + dest: '{{ checkout_dir }}' + single_branch: yes + register: single_branch_2 + +- name: SINGLE_BRANCH | List revisions + command: git rev-list --all --count + args: + chdir: '{{ checkout_dir }}' + register: rev_list1 + when: git_version.stdout is version(git_version_supporting_single_branch, '>=') + +- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git >= {{ git_version_supporting_single_branch }} + assert: + that: + - single_branch_1 is changed + - single_branch_2 is not changed + when: git_version.stdout is version(git_version_supporting_single_branch, '>=') + +- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git < {{ git_version_supporting_single_branch }} + assert: + that: + - single_branch_1 is changed + - single_branch_1.warnings | length == 1 + - single_branch_2 is not changed + when: git_version.stdout is version(git_version_supporting_single_branch, '<') + + +- name: SINGLE_BRANCH | clear checkout_dir + file: + state: absent + path: "{{ checkout_dir }}" + +- name: SINGLE_BRANCH | Clone example git repo using single_branch with version + git: + repo: 'file://{{ repo_dir|expanduser }}/shallow_branches' + dest: '{{ checkout_dir }}' + single_branch: yes + version: master + register: single_branch_3 + +- name: SINGLE_BRANCH | Clone example git repo using single_branch with version again + git: + repo: 'file://{{ repo_dir|expanduser }}/shallow_branches' + dest: '{{ checkout_dir }}' + single_branch: yes + version: master + register: single_branch_4 + +- name: SINGLE_BRANCH | List revisions + command: git rev-list --all --count + args: + chdir: '{{ checkout_dir }}' + register: rev_list2 + when: git_version.stdout is version(git_version_supporting_single_branch, '>=') + +- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git >= {{ git_version_supporting_single_branch }} + assert: + that: + - single_branch_3 is changed + - single_branch_4 is not changed + - rev_list2.stdout == '1' + when: git_version.stdout is version(git_version_supporting_single_branch, '>=') + +- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git < {{ git_version_supporting_single_branch }} + assert: + that: + - single_branch_3 is changed + - single_branch_3.warnings | length == 1 + - single_branch_4 is not changed + when: git_version.stdout is version(git_version_supporting_single_branch, '<') |