1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/flatpak/tasks/check_mode.yml
Felix Fontein bb37b67166
flatpak: add tests in CI, add no_dependencies parameter (#2751)
* Similar version restrictions than flatpak_remote tests.

* ...

* Try to work around missing dependencies.

* Revert "Try to work around missing dependencies."

This reverts commit 66a4e38566.

* Add changelog.

* App8 -> App2; make sure that there are two apps App1 and App2.

* Fix forgotten variabe.

* Remove test notices.

* Seems like flatpak no longer supports file:// URLs.

The tests would need to be rewritten to offer the URL via http:// instead.

* Try local HTTP server for URL tests.

* ...

* Lint, add status check.

* Add boilerplate.

* Add 'ps aux'.

* Surrender to -f.

* Work around apparent flatpak bug.

* Fix YAML.

* Improve condition.

* Make sure test reruns behave better.
2021-06-08 08:46:20 +02:00

192 lines
5.7 KiB
YAML

# - Tests with absent flatpak --------------------------------------------------
# state=present on absent flatpak
- name: Test addition of absent flatpak (check mode)
flatpak:
name: com.dummy.App1
remote: dummy-remote
state: present
register: addition_result
check_mode: true
- name: Verify addition of absent flatpak test result (check mode)
assert:
that:
- addition_result is changed
msg: "Adding an absent flatpak shall mark module execution as changed"
- name: Test non-existent idempotency of addition of absent flatpak (check mode)
flatpak:
name: com.dummy.App1
remote: dummy-remote
state: present
register: double_addition_result
check_mode: true
- name: Verify non-existent idempotency of addition of absent flatpak test result (check mode)
assert:
that:
- double_addition_result is changed
msg: |
Adding an absent flatpak a second time shall still mark module execution
as changed in check mode
# state=absent on absent flatpak
- name: Test removal of absent flatpak check mode
flatpak:
name: com.dummy.App1
state: absent
register: removal_result
check_mode: true
- name: Verify removal of absent flatpak test result (check mode)
assert:
that:
- removal_result is not changed
msg: "Removing an absent flatpak shall mark module execution as not changed"
# state=present with url on absent flatpak
- name: Test addition of absent flatpak with url (check mode)
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
remote: dummy-remote
state: present
register: url_addition_result
check_mode: true
- name: Verify addition of absent flatpak with url test result (check mode)
assert:
that:
- url_addition_result is changed
msg: "Adding an absent flatpak from URL shall mark module execution as changed"
- name: Test non-existent idempotency of addition of absent flatpak with url (check mode)
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
remote: dummy-remote
state: present
register: double_url_addition_result
check_mode: true
- name: >
Verify non-existent idempotency of additionof absent flatpak with url test
result (check mode)
assert:
that:
- double_url_addition_result is changed
msg: |
Adding an absent flatpak from URL a second time shall still mark module execution
as changed in check mode
# state=absent with url on absent flatpak
- name: Test removal of absent flatpak with url not doing anything (check mode)
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
state: absent
register: url_removal_result
check_mode: true
- name: Verify removal of absent flatpak with url test result (check mode)
assert:
that:
- url_removal_result is not changed
msg: "Removing an absent flatpak shall mark module execution as not changed"
# - Tests with present flatpak -------------------------------------------------
# state=present on present flatpak
- name: Test addition of present flatpak (check mode)
flatpak:
name: com.dummy.App2
remote: dummy-remote
state: present
register: addition_present_result
check_mode: true
- name: Verify addition test result of present flatpak (check mode)
assert:
that:
- addition_present_result is not changed
msg: "Adding an present flatpak shall mark module execution as not changed"
# state=absent on present flatpak
- name: Test removal of present flatpak (check mode)
flatpak:
name: com.dummy.App2
state: absent
register: removal_present_result
check_mode: true
- name: Verify removal of present flatpak test result (check mode)
assert:
that:
- removal_present_result is changed
msg: "Removing a present flatpak shall mark module execution as changed"
- name: Test non-existent idempotency of removal (check mode)
flatpak:
name: com.dummy.App2
state: absent
register: double_removal_present_result
check_mode: true
- name: Verify non-existent idempotency of removal (check mode)
assert:
that:
- double_removal_present_result is changed
msg: |
Removing a present flatpak a second time shall still mark module execution
as changed in check mode
# state=present with url on present flatpak
- name: Test addition with url of present flatpak (check mode)
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
remote: dummy-remote
state: present
register: url_addition_present_result
check_mode: true
- name: Verify addition with url of present flatpak test result (check mode)
assert:
that:
- url_addition_present_result is not changed
msg: "Adding a present flatpak from URL shall mark module execution as not changed"
# state=absent with url on present flatpak
- name: Test removal with url of present flatpak (check mode)
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
state: absent
register: url_removal_present_result
check_mode: true
- name: Verify removal with url of present flatpak test result (check mode)
assert:
that:
- url_removal_present_result is changed
msg: "Removing an absent flatpak shall mark module execution as not changed"
- name: Test non-existent idempotency of removal with url of present flatpak (check mode)
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
remote: dummy-remote
state: absent
register: double_url_removal_present_result
check_mode: true
- name: >
Verify non-existent idempotency of installation with url of present
flatpak test result (check mode)
assert:
that:
- double_url_removal_present_result is changed
msg: Removing an absent flatpak a second time shall still mark module execution as changed