ansible.posix/tests/integration/targets/patch/tasks/main.yml
John R Barker 07f1a2e98e
Bootstrap Collection (#1)
* Bootstrap Collection

* Basic common bootstrapping of repo
* Correct Galaxy settings
* Attempt to get Shippable working

* correct directory

* patch is part of ansible.posix (not community.general

* tests/utils/shippable/ missing from ignore.txt

* shippable/units.sh from a/a:devel

* ignore.txt:patch

* CI: Only use group1 for integration

* Correct Repo URLs

Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* HACK: Install community.general

* run integration tests first

* Install community.general in correct location

* deleted too much

* Use Extended FQCN for community.general

* Use temp-2.10-devel

* Update tests/utils/shippable/sanity.sh

Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2020-03-13 09:12:26 +00:00

89 lines
2.3 KiB
YAML

- name: ensure idempotency installed
package:
name: patch
when: ansible_distribution != "MacOSX"
- name: create a directory for the result
file:
dest: '{{ output_dir }}/patch'
state: directory
register: result
- name: assert the directory was created
assert:
that:
- result.state == 'directory'
- name: copy the origin file
copy:
src: ./origin.txt
dest: '{{ output_dir }}/patch/workfile.txt'
register: result
- name: patch the origin file in check mode
check_mode: true
register: result
patch:
src: result.patch
dest: '{{ output_dir }}/patch/workfile.txt'
- name: verify patch the origin file in check mode
assert:
that:
- result is changed
- name: patch the origin file
register: result
patch:
src: result.patch
dest: '{{ output_dir }}/patch/workfile.txt'
- name: verify patch the origin file
assert:
that:
- result is changed
- name: test patch the origin file idempotency
register: result
patch:
src: result.patch
dest: '{{ output_dir }}/patch/workfile.txt'
- name: verify test patch the origin file idempotency
assert:
that:
- result is not changed
- name: verify the resulted file matches expectations
copy:
src: ./result.txt
dest: '{{ output_dir }}/patch/workfile.txt'
register: result
failed_when: result is changed
- name: patch the workfile file in check mode state absent
check_mode: true
register: result
patch:
src: result.patch
dest: '{{ output_dir }}/patch/workfile.txt'
state: absent
- name: verify patch the workfile file in check mode state absent
assert:
that:
- result is changed
- name: patch the workfile file state absent
register: result
patch:
src: result.patch
dest: '{{ output_dir }}/patch/workfile.txt'
state: absent
- name: verify patch the workfile file state absent
assert:
that:
- result is changed
- name: patch the workfile file state absent idempotency
register: result
patch:
src: result.patch
dest: '{{ output_dir }}/patch/workfile.txt'
state: absent
- name: verify patch the workfile file state absent idempotency
assert:
that:
- result is not changed
- name: verify the resulted file matches expectations
copy:
src: ./origin.txt
dest: '{{ output_dir }}/patch/workfile.txt'
register: result
failed_when: result is changed