mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-12 23:15:06 +00:00
68 lines
2 KiB
YAML
68 lines
2 KiB
YAML
---
|
|
|
|
# -----------------------------------------------------------
|
|
|
|
- name: "[{{ item }}] Given a started service in check_mode"
|
|
launchd:
|
|
name: "{{ launchd_service_name }}"
|
|
state: started
|
|
become: yes
|
|
register: "test_1_launchd_start_result_check_mode"
|
|
check_mode: yes
|
|
|
|
- name: "[{{ item }}] Assert that everything work in check mode"
|
|
assert:
|
|
that:
|
|
- test_1_launchd_start_result_check_mode is success
|
|
- test_1_launchd_start_result_check_mode is changed
|
|
|
|
- name: "[{{ item }}] Given a started service..."
|
|
launchd:
|
|
name: "{{ launchd_service_name }}"
|
|
state: started
|
|
become: yes
|
|
register: "test_1_launchd_start_result"
|
|
|
|
|
|
- name: "[{{ item }}] The started service should run on port 21212"
|
|
wait_for:
|
|
port: 21212
|
|
delay: 5
|
|
timeout: 10
|
|
|
|
- name: "[{{ item }}] Deploy a new test service configuration with a new port 21213"
|
|
template:
|
|
src: "modified.{{ launchd_service_name }}.plist.j2"
|
|
dest: "{{ launchd_plist_location }}"
|
|
become: yes
|
|
|
|
- name: "[{{ item }}] When reloading the service..."
|
|
launchd:
|
|
name: "{{ launchd_service_name }}"
|
|
state: reloaded
|
|
become: yes
|
|
register: "test_1_launchd_reload_result"
|
|
|
|
- name: "[{{ item }}] Validate that service was reloaded"
|
|
assert:
|
|
that:
|
|
- test_1_launchd_reload_result is success
|
|
- test_1_launchd_reload_result is changed
|
|
- test_1_launchd_reload_result.status.previous_pid == test_1_launchd_start_result.status.current_pid
|
|
- test_1_launchd_reload_result.status.previous_state == test_1_launchd_start_result.status.current_state
|
|
- test_1_launchd_reload_result.status.current_state == 'stopped'
|
|
- test_1_launchd_reload_result.status.current_pid == '-'
|
|
|
|
- name: "[{{ item }}] Start the service with the new configuration..."
|
|
launchd:
|
|
name: "{{ launchd_service_name }}"
|
|
state: started
|
|
become: yes
|
|
register: "test_1_launchd_start_result"
|
|
|
|
|
|
- name: "[{{ item }}] The started service should run on port 21213"
|
|
wait_for:
|
|
port: 21213
|
|
delay: 5
|
|
timeout: 10
|