2020-03-09 10:11:07 +01:00
|
|
|
# state=present
|
|
|
|
|
|
|
|
- name: Test addition - {{ method }}
|
|
|
|
flatpak:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: com.dummy.App1
|
|
|
|
remote: dummy-remote
|
2020-03-09 10:11:07 +01:00
|
|
|
state: present
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: addition_result
|
|
|
|
|
|
|
|
- name: Verify addition test result - {{ method }}
|
|
|
|
assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- addition_result is changed
|
2020-06-26 08:31:53 +02:00
|
|
|
msg: "state=present shall add flatpak when absent"
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Test idempotency of addition - {{ method }}
|
|
|
|
flatpak:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: com.dummy.App1
|
|
|
|
remote: dummy-remote
|
2020-03-09 10:11:07 +01:00
|
|
|
state: present
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: double_addition_result
|
|
|
|
|
|
|
|
- name: Verify idempotency of addition test result - {{ method }}
|
|
|
|
assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- double_addition_result is not changed
|
2020-03-09 10:11:07 +01:00
|
|
|
msg: "state=present shall not do anything when flatpak is already present"
|
|
|
|
|
|
|
|
# state=absent
|
|
|
|
|
|
|
|
- name: Test removal - {{ method }}
|
|
|
|
flatpak:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: com.dummy.App1
|
2020-03-09 10:11:07 +01:00
|
|
|
state: absent
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: removal_result
|
|
|
|
|
|
|
|
- name: Verify removal test result - {{ method }}
|
|
|
|
assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- removal_result is changed
|
2020-03-09 10:11:07 +01:00
|
|
|
msg: "state=absent shall remove flatpak when present"
|
|
|
|
|
|
|
|
- name: Test idempotency of removal - {{ method }}
|
|
|
|
flatpak:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: com.dummy.App1
|
2020-03-09 10:11:07 +01:00
|
|
|
state: absent
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: double_removal_result
|
|
|
|
|
|
|
|
- name: Verify idempotency of removal test result - {{ method }}
|
|
|
|
assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- double_removal_result is not changed
|
2020-03-09 10:11:07 +01:00
|
|
|
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:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
|
|
|
remote: dummy-remote
|
2020-03-09 10:11:07 +01:00
|
|
|
state: present
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: url_addition_result
|
|
|
|
|
|
|
|
- name: Verify addition test result - {{ method }}
|
|
|
|
assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- url_addition_result is changed
|
2020-06-26 08:31:53 +02:00
|
|
|
msg: "state=present with url as name shall add flatpak when absent"
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Test idempotency of addition with url - {{ method }}
|
|
|
|
flatpak:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
|
|
|
remote: dummy-remote
|
2020-03-09 10:11:07 +01:00
|
|
|
state: present
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: double_url_addition_result
|
|
|
|
|
|
|
|
- name: Verify idempotency of addition with url test result - {{ method }}
|
|
|
|
assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- double_url_addition_result is not changed
|
2020-03-09 10:11:07 +01:00
|
|
|
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:
|
2021-06-08 08:46:20 +02:00
|
|
|
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
2020-03-09 10:11:07 +01:00
|
|
|
state: absent
|
|
|
|
method: "{{ method }}"
|
2021-06-08 08:46:20 +02:00
|
|
|
no_dependencies: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: url_removal_result
|
2021-06-08 08:46:20 +02:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
2021-06-08 08:46:20 +02:00
|
|
|
- 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.)
|
2020-03-09 10:11:07 +01:00
|
|
|
assert:
|
|
|
|
that:
|
2021-06-08 08:46:20 +02:00
|
|
|
- >-
|
|
|
|
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"
|