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/test.yml
patchback[bot] ac543f5ef0
flatpak: add tests in CI, add no_dependencies parameter (#2751) (#2754)
* 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.

(cherry picked from commit bb37b67166)

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-06-08 09:14:10 +02:00

141 lines
4.1 KiB
YAML

# state=present
- name: Test addition - {{ method }}
flatpak:
name: com.dummy.App1
remote: dummy-remote
state: present
method: "{{ method }}"
no_dependencies: true
register: addition_result
- name: Verify addition test result - {{ method }}
assert:
that:
- addition_result is changed
msg: "state=present shall add flatpak when absent"
- name: Test idempotency of addition - {{ method }}
flatpak:
name: com.dummy.App1
remote: dummy-remote
state: present
method: "{{ method }}"
no_dependencies: true
register: double_addition_result
- name: Verify idempotency of addition test result - {{ method }}
assert:
that:
- double_addition_result is not changed
msg: "state=present shall not do anything when flatpak is already present"
# state=absent
- name: Test removal - {{ method }}
flatpak:
name: com.dummy.App1
state: absent
method: "{{ method }}"
no_dependencies: true
register: removal_result
- name: Verify removal test result - {{ method }}
assert:
that:
- removal_result is changed
msg: "state=absent shall remove flatpak when present"
- name: Test idempotency of removal - {{ method }}
flatpak:
name: com.dummy.App1
state: absent
method: "{{ method }}"
no_dependencies: true
register: double_removal_result
- name: Verify idempotency of removal test result - {{ method }}
assert:
that:
- double_removal_result is not changed
msg: "state=absent shall not do anything when flatpak is not present"
# state=present with url as name
- name: Test addition with url - {{ method }}
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
remote: dummy-remote
state: present
method: "{{ method }}"
no_dependencies: true
register: url_addition_result
- name: Verify addition test result - {{ method }}
assert:
that:
- url_addition_result is changed
msg: "state=present with url as name shall add flatpak when absent"
- name: Test idempotency of addition with url - {{ method }}
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
remote: dummy-remote
state: present
method: "{{ method }}"
no_dependencies: true
register: double_url_addition_result
- name: Verify idempotency of addition with url test result - {{ method }}
assert:
that:
- double_url_addition_result is not changed
msg: "state=present with url as name shall not do anything when flatpak is already present"
# state=absent with url as name
- name: Test removal with url - {{ method }}
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
state: absent
method: "{{ method }}"
no_dependencies: true
register: url_removal_result
ignore_errors: true
- name: Verify removal test result failed - {{ method }}
# It looks like flatpak has a bug when the hostname contains a port. If this is the case, it emits
# the following message, which we check for. If another error happens, we fail.
# Upstream issue: https://github.com/flatpak/flatpak/issues/4307
# (The second message happens with Ubuntu 18.04.)
assert:
that:
- >-
url_removal_result.msg in [
"error: Invalid branch 127.0.0.1:8000: Branch can't contain :",
"error: Invalid id http:: Name can't contain :",
]
when: url_removal_result is failed
- when: url_removal_result is not failed
block:
- name: Verify removal test result - {{ method }}
assert:
that:
- url_removal_result is changed
msg: "state=absent with url as name shall remove flatpak when present"
- name: Test idempotency of removal with url - {{ method }}
flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
state: absent
method: "{{ method }}"
no_dependencies: true
register: double_url_removal_result
- name: Verify idempotency of removal with url test result - {{ method }}
assert:
that:
- double_url_removal_result is not changed
msg: "state=absent with url as name shall not do anything when flatpak is not present"