mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Skip some service tests for systemd.
This commit is contained in:
parent
c52cea8db3
commit
e45b3b89a2
4 changed files with 19 additions and 0 deletions
|
@ -38,39 +38,47 @@
|
||||||
- name: find the service with a pattern
|
- name: find the service with a pattern
|
||||||
service: name=ansible_test pattern="ansible_test_ser*" state=started
|
service: name=ansible_test pattern="ansible_test_ser*" state=started
|
||||||
register: start2_result
|
register: start2_result
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: assert that the service was started via the pattern
|
- name: assert that the service was started via the pattern
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "start2_result.name == 'ansible_test'"
|
- "start2_result.name == 'ansible_test'"
|
||||||
- "start2_result.state == 'started'"
|
- "start2_result.state == 'started'"
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: restart the ansible test service
|
- name: restart the ansible test service
|
||||||
service: name=ansible_test state=restarted
|
service: name=ansible_test state=restarted
|
||||||
register: restart_result
|
register: restart_result
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: assert that the service was restarted
|
- name: assert that the service was restarted
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "restart_result.state == 'started'"
|
- "restart_result.state == 'started'"
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: restart the ansible test service with a sleep
|
- name: restart the ansible test service with a sleep
|
||||||
service: name=ansible_test state=restarted sleep=2
|
service: name=ansible_test state=restarted sleep=2
|
||||||
register: restart_sleep_result
|
register: restart_sleep_result
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: assert that the service was restarted with a sleep
|
- name: assert that the service was restarted with a sleep
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "restart_sleep_result.state == 'started'"
|
- "restart_sleep_result.state == 'started'"
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: reload the ansible test service
|
- name: reload the ansible test service
|
||||||
service: name=ansible_test state=reloaded
|
service: name=ansible_test state=reloaded
|
||||||
register: reload_result
|
register: reload_result
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: assert that the service was reloaded
|
- name: assert that the service was reloaded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "reload_result.state == 'started'"
|
- "reload_result.state == 'started'"
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: stop the ansible test service
|
- name: stop the ansible test service
|
||||||
service: name=ansible_test state=stopped
|
service: name=ansible_test state=stopped
|
||||||
|
@ -84,11 +92,13 @@
|
||||||
- name: disable the ansible test service
|
- name: disable the ansible test service
|
||||||
service: name=ansible_test enabled=no
|
service: name=ansible_test enabled=no
|
||||||
register: disable_result
|
register: disable_result
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: assert that the service was disabled
|
- name: assert that the service was disabled
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "disable_result.enabled == false"
|
- "disable_result.enabled == false"
|
||||||
|
when: service_type != "systemd"
|
||||||
|
|
||||||
- name: try to enable a broken service
|
- name: try to enable a broken service
|
||||||
service: name=ansible_broken_test enabled=yes
|
service: name=ansible_broken_test enabled=yes
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
- name: set service_type fact
|
||||||
|
set_fact: service_type=systemd
|
||||||
|
|
||||||
- name: install the systemd unit file
|
- name: install the systemd unit file
|
||||||
copy: src=ansible.systemd dest=/etc/systemd/system/ansible_test.service
|
copy: src=ansible.systemd dest=/etc/systemd/system/ansible_test.service
|
||||||
register: install_systemd_result
|
register: install_systemd_result
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
- name: set service_type fact
|
||||||
|
set_fact: service_type=sysv
|
||||||
|
|
||||||
- name: install the sysV init file
|
- name: install the sysV init file
|
||||||
copy: src=ansible.sysv dest=/etc/init.d/ansible_test mode=0755
|
copy: src=ansible.sysv dest=/etc/init.d/ansible_test mode=0755
|
||||||
register: install_sysv_result
|
register: install_sysv_result
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
- name: set service_type fact
|
||||||
|
set_fact: service_type=upstart
|
||||||
|
|
||||||
- name: install the upstart init file
|
- name: install the upstart init file
|
||||||
copy: src=ansible.upstart dest=/etc/init/ansible_test.conf mode=0644
|
copy: src=ansible.upstart dest=/etc/init/ansible_test.conf mode=0644
|
||||||
register: install_upstart_result
|
register: install_upstart_result
|
||||||
|
|
Loading…
Reference in a new issue