mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 04:24:00 -07:00
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.17) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.12) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.7) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* Adjust all __future__ imports: for i in $(grep -REl "__future__.*absolute_import" plugins/ tests/); do sed -e 's/from __future__ import .*/from __future__ import annotations/g' -i $i; done * Remove all UTF-8 encoding specifications for Python source files: for i in $(grep -REl '[-][*]- coding: utf-8 -[*]-' plugins/ tests/); do sed -e '/^# -\*- coding: utf-8 -\*-/d' -i $i; done * Remove __metaclass__ = type: for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do sed -e '/^__metaclass__ = type/d' -i $i; done
215 lines
7.1 KiB
YAML
215 lines
7.1 KiB
YAML
# Copyright (c) Dexter Le (dextersydney2001@gmail.com)
|
|
# 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
|
|
|
|
---
|
|
anchors:
|
|
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: false}
|
|
test_cases:
|
|
- id: test_missing_input
|
|
input: {}
|
|
output:
|
|
failed: true
|
|
msg: "missing required arguments: name"
|
|
- id: test_present_minimal_input_stonith_not_exists
|
|
input:
|
|
state: present
|
|
name: virtual-stonith
|
|
stonith_type: fence_virt
|
|
stonith_options:
|
|
- "pcmk_host_list=f1"
|
|
stonith_operations:
|
|
- operation_action: monitor
|
|
operation_options:
|
|
- "interval=30s"
|
|
output:
|
|
changed: true
|
|
previous_value: null
|
|
value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, create, virtual-stonith, fence_virt, "pcmk_host_list=f1", "op", "monitor", "interval=30s", "--wait=300"]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
err: ""
|
|
- id: test_present_minimal_input_stonith_exists
|
|
input:
|
|
state: present
|
|
name: virtual-stonith
|
|
stonith_type: fence_virt
|
|
stonith_options:
|
|
- "pcmk_host_list=f1"
|
|
stonith_operations:
|
|
- operation_action: monitor
|
|
operation_options:
|
|
- "interval=30s"
|
|
output:
|
|
changed: false
|
|
previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, create, virtual-stonith, fence_virt, "pcmk_host_list=f1", "op", "monitor", "interval=30s", "--wait=300"]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: ""
|
|
err: "Error: 'virtual-stonith' already exists.\n"
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
err: ""
|
|
- id: test_absent_minimal_input_stonith_not_exists
|
|
input:
|
|
state: absent
|
|
name: virtual-stonith
|
|
output:
|
|
changed: false
|
|
previous_value: null
|
|
value: null
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, remove, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: "Error: Resource 'virtual-stonith' does not exist.\n"
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: ""
|
|
- id: test_absent_minimal_input_stonith_exists
|
|
input:
|
|
state: absent
|
|
name: virtual-stonith
|
|
output:
|
|
changed: true
|
|
previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
value: null
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, remove, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: ""
|
|
err: "Attempting to stop: virtual-ip... Stopped\n"
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: ""
|
|
- id: test_enabled_minimal_input_stonith_not_exists
|
|
input:
|
|
state: enabled
|
|
name: virtual-stonith
|
|
output:
|
|
failed: true
|
|
msg: "pcs failed with error (rc=1): Error: Resource 'virtual-stonith' does not exist."
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, enable, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: "Error: Resource 'virtual-stonith' does not exist."
|
|
- id: test_enabled_minimal_input_stonith_exists
|
|
input:
|
|
state: enabled
|
|
name: virtual-stonith
|
|
output:
|
|
changed: true
|
|
previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
|
|
value: " * virtual-stonith\t(stonith:fence_virt):\t Starting"
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, enable, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Starting"
|
|
err: ""
|
|
- id: test_disable_minimal_input_stonith_not_exists
|
|
input:
|
|
state: disabled
|
|
name: virtual-stonith
|
|
output:
|
|
failed: true
|
|
msg: "pcs failed with error (rc=1): Error: Resource 'virtual-stonith' does not exist."
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, disable, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 1
|
|
out: ""
|
|
err: "Error: Resource 'virtual-stonith' does not exist."
|
|
- id: test_disable_minimal_input_stonith_exists
|
|
input:
|
|
state: disabled
|
|
name: virtual-stonith
|
|
output:
|
|
changed: true
|
|
previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
value: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
|
|
mocks:
|
|
run_command:
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, disable, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: ""
|
|
err: ""
|
|
- command: ["/testbin/pcs", stonith, status, virtual-stonith]
|
|
environ: *env-def
|
|
rc: 0
|
|
out: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
|
|
err: ""
|