diff --git a/.woodpecker.yml b/.woodpecker.yml index 04c66a1..1cabf00 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -15,7 +15,7 @@ pipeline: - apk --update add ansible py3-requests curl - ansible-galaxy collection build - ansible-galaxy collection install markuman-nextcloud-* - - ansible-playbook tests/integration.yml + - cd tests/integration/targets/ && ansible-playbook woodpecker.yml services: nextcloud21: diff --git a/tests/integration/targets/woodpecker.yml b/tests/integration/targets/woodpecker.yml new file mode 100644 index 0000000..8fe8b41 --- /dev/null +++ b/tests/integration/targets/woodpecker.yml @@ -0,0 +1,97 @@ +--- +- hosts: localhost + connection: local + gather_facts: no + + tasks: + - name: wait for nextcloud (pull image and install) + get_url: + url: http://nextcloud21 + dest: /tmp/test + register: status + until: status.failed == false + delay: 5 + retries: 50 + + - name: test + block: + ########### prepair + - name: Download ansible.svg from wikipedia + get_url: + url: https://de.wikipedia.org/wiki/Ansible#/media/Datei:Ansible_logo.svg + dest: /tmp/ansible.svg + + ########### test + - name: upload file on nextcloud + markuman.nextcloud.file: + mode: put + src: /tmp/ansible.svg + dest: ansible.svg + ssl_mode: http + register: out_state + + - name: state must be changed + assert: + that: + - out_state is changed + + - name: GET file from nextcloud + markuman.nextcloud.file: + mode: get + src: ansible.svg + dest: /tmp/tmp.svg + ssl_mode: http + register: out_state + + - name: state must be changed + assert: + that: + - out_state is changed + + - name: OK fetch file from nextcloud + markuman.nextcloud.file: + mode: get + src: ansible.svg + dest: /tmp/ansible.svg + overwritten: different + ssl_mode: http + register: out_state + + - name: state must not be changed + assert: + that: + - out_state is not changed + + - name: delete file on nextcloud + markuman.nextcloud.file: + mode: delete + src: ansible.svg + ssl_mode: http + register: out_state + + - name: state must be changed + assert: + that: + - out_state is changed + + - name: immutable delete file on nextcloud + markuman.nextcloud.file: + mode: delete + src: ansible.svg + ssl_mode: http + register: out_state + + - name: state must not be changed + assert: + that: + - out_state is not changed + + - name: get nc users + markuman.nextcloud.user_info: + ssl_mode: http + register: out + + - name: verify change + assert: + that: + - out.users | count == 1 \ No newline at end of file