1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-03 08:52:55 +00:00
community.general/tests/integration/targets/launchd/tasks/tests/test_runatload.yml
patchback[bot] ec7f885e2f
[PR #5996/24efe9ee backport][stable-6] Normalize bools in tests (#5997)
Normalize bools in tests (#5996)

* Normalize bools in tests.

* Fix typo.

(cherry picked from commit 24efe9ee9a)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-02-16 06:42:27 +01:00

36 lines
1.3 KiB
YAML

---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# -----------------------------------------------------------
- name: "[{{ item }}] Given a started service with RunAtLoad set to true..."
launchd:
name: "{{ launchd_service_name }}"
state: started
enabled: true
become: true
register: test_1_launchd_start_result
- name: "[{{ item }}] Validate that service was started"
assert:
that:
- test_1_launchd_start_result is success
- test_1_launchd_start_result is changed
- test_1_launchd_start_result.status.previous_pid == '-'
- test_1_launchd_start_result.status.previous_state == 'unloaded'
- test_1_launchd_start_result.status.current_state == 'started'
- test_1_launchd_start_result.status.current_pid != '-'
- test_1_launchd_start_result.status.status_code == '0'
- name: "[{{ item }}] Validate that RunAtLoad is set to true"
replace:
path: "{{ launchd_plist_location }}"
regexp: |
\s+<key>RunAtLoad</key>
\s+<true/>
replace: found_run_at_load
check_mode: true
register: contents_would_have
failed_when: not contents_would_have is changed