mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 04:34:24 -07:00
pacemaker_cluster: enhancements and add unit tests (#10227)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* feat(initial): Add unit tests and rewrite pacemaker_cluster This commit introduces unit tests and pacemaker_cluster module rewrite to use the pacemaker module utils. * feat(cleanup): Various fixes and add resource state This commit migrates the pacemaker_cluster's cleanup state to the pacemaker_resource module. Additionally, the unit tests for pacemaker_cluster have been corrected to proper mock run command order. * doc(botmeta): Add author to pacemaker_cluster * style(whitespace): Cleanup test files * refactor(cleanup): Remove unused state value * bug(fix): Parse apply_all as separate option * refactor(review): Apply code review suggestions This commit refactors breaking changes in pacemaker_cluster module into deprecated features. The following will be scheduled for deprecation: `state: cleanup` and `state: None`. * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * refactor(review): Additional review suggestions * refactor(deprecations): Remove all deprecation changes * refactor(review): Enhance rename changelog entry and fix empty string logic * refactor(cleanup): Remove from pacemaker_resource * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * refactor(review): Add changelog and revert required name * revert(default): Use default state=present * Update changelogs/fragments/10227-pacemaker-cluster-and-resource-enhancement.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelog fragment. --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
4801b0fc00
commit
283d947f17
8 changed files with 695 additions and 156 deletions
19
tests/unit/plugins/modules/test_pacemaker_cluster.py
Normal file
19
tests/unit/plugins/modules/test_pacemaker_cluster.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Author: Dexter Le (dextersydney2001@gmail.com)
|
||||
# Largely adapted from test_redhat_subscription by
|
||||
# Jiri Hnidek (jhnidek@redhat.com)
|
||||
#
|
||||
# Copyright (c) Dexter Le (dextersydney2001@gmail.com)
|
||||
# Copyright (c) Jiri Hnidek (jhnidek@redhat.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
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import pacemaker_cluster
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
UTHelper.from_module(pacemaker_cluster, __name__, mocks=[RunCommandMock])
|
488
tests/unit/plugins/modules/test_pacemaker_cluster.yaml
Normal file
488
tests/unit/plugins/modules/test_pacemaker_cluster.yaml
Normal file
|
@ -0,0 +1,488 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# 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_online_minimal_input_initial_online_all_no_maintenance
|
||||
input:
|
||||
state: online
|
||||
output:
|
||||
changed: false
|
||||
previous_value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_online_minimal_input_initial_offline_all_maintenance
|
||||
input:
|
||||
state: online
|
||||
output:
|
||||
changed: true
|
||||
previous_value: 'Error: cluster is not currently running on this node'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
maintenance-mode=true
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, set, maintenance-mode=false]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ""
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_online_minimal_input_initial_offline_single_nonlocal_no_maintenance
|
||||
input:
|
||||
state: online
|
||||
name: pc2
|
||||
output:
|
||||
changed: true
|
||||
previous_value: '* Node pc2: UNCLEAN (offline)\n * Online: [ pc1, pc3 ]'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: '* Node pc2: UNCLEAN (offline)\n * Online: [ pc1, pc3 ]'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, pc2, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_online_minimal_input_initial_offline_single_local_no_maintenance
|
||||
input:
|
||||
state: online
|
||||
name: pc1
|
||||
output:
|
||||
changed: true
|
||||
previous_value: 'Error: cluster is not currently running on this node'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, pc1, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_offline_minimal_input_initial_online_all
|
||||
input:
|
||||
state: offline
|
||||
output:
|
||||
changed: true
|
||||
previous_value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
value: 'Error: cluster is not currently running on this node'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, stop, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Stopping Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- id: test_offline_minimal_input_initial_offline_all
|
||||
input:
|
||||
state: offline
|
||||
output:
|
||||
changed: false
|
||||
previous_value: 'Error: cluster is not currently running on this node'
|
||||
value: 'Error: cluster is not currently running on this node'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, stop, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Stopping Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- id: test_offline_minimal_input_initial_offline_single_nonlocal
|
||||
input:
|
||||
state: offline
|
||||
name: pc3
|
||||
output:
|
||||
changed: true
|
||||
previous_value: '* Node pc2: UNCLEAN (offline)\n * Online: [ pc1, pc3 ]'
|
||||
value: '* Node pc2: UNCLEAN (offline)\n* Node pc3: UNCLEAN (offline)\n * Online: [ pc1 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: '* Node pc2: UNCLEAN (offline)\n * Online: [ pc1, pc3 ]'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, stop, pc3, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Stopping Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: '* Node pc2: UNCLEAN (offline)\n* Node pc3: UNCLEAN (offline)\n * Online: [ pc1 ]'
|
||||
err: ""
|
||||
- id: test_restart_minimal_input_initial_online_all_no_maintenance
|
||||
input:
|
||||
state: restart
|
||||
output:
|
||||
changed: false
|
||||
previous_value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, stop, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Stopping Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_restart_minimal_input_initial_offline_all_no_maintenance
|
||||
input:
|
||||
state: restart
|
||||
output:
|
||||
changed: true
|
||||
previous_value: 'Error: cluster is not currently running on this node'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, stop, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Stopping Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_restart_minimal_input_initial_offline_all_maintenance
|
||||
input:
|
||||
state: restart
|
||||
output:
|
||||
changed: true
|
||||
previous_value: 'Error: cluster is not currently running on this node'
|
||||
value: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: 'Error: cluster is not currently running on this node'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, stop, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Stopping Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, start, --all, --wait=300]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Starting Cluster..."
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
maintenance-mode=true
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, set, maintenance-mode=false]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ""
|
||||
err: ""
|
||||
- command: [/testbin/pcs, cluster, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ' * Online: [ pc1, pc2, pc3 ]'
|
||||
err: ""
|
||||
- id: test_maintenance_minimal_input_initial_online
|
||||
input:
|
||||
state: maintenance
|
||||
output:
|
||||
changed: true
|
||||
previous_value: 'maintenance-mode=false (default)'
|
||||
value: 'maintenance-mode=true'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, property, config, maintenance-mode]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: 'maintenance-mode=false (default)'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, set, maintenance-mode=true]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ""
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config, maintenance-mode]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: 'maintenance-mode=true'
|
||||
err: ""
|
||||
- id: test_maintenance_minimal_input_initial_offline
|
||||
input:
|
||||
state: maintenance
|
||||
output:
|
||||
failed: true
|
||||
msg: "pcs failed with error (rc=1): Error: unable to get cib"
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, property, config, maintenance-mode]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: ""
|
||||
err: "Error: unable to get cib"
|
||||
- command: [/testbin/pcs, property, set, maintenance-mode=true]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: ""
|
||||
err: "Error: unable to get cib"
|
||||
- id: test_maintenance_minimal_input_initial_maintenance
|
||||
input:
|
||||
state: maintenance
|
||||
output:
|
||||
changed: false
|
||||
previous_value: 'maintenance-mode=true'
|
||||
value: 'maintenance-mode=true'
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, property, config, maintenance-mode]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: 'maintenance-mode=true'
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, set, maintenance-mode=true]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: ""
|
||||
err: ""
|
||||
- command: [/testbin/pcs, property, config, maintenance-mode]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: 'maintenance-mode=true'
|
||||
err: ""
|
||||
- id: test_cleanup_minimal_input_initial_resources_not_exist
|
||||
input:
|
||||
state: cleanup
|
||||
output:
|
||||
changed: false
|
||||
previous_value: "NO resources configured"
|
||||
value: "NO resources configured"
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, resource, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "NO resources configured"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, cleanup]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Cleaned up all resources on all nodes"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "NO resources configured"
|
||||
err: ""
|
||||
- id: test_cleanup_minimal_input_initial_resources_exists
|
||||
input:
|
||||
state: cleanup
|
||||
output:
|
||||
changed: true
|
||||
previous_value: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
value: "NO resources configured"
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, resource, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, cleanup]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Cleaned up all resources on all nodes"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, status]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "NO resources configured"
|
||||
err: ""
|
||||
- id: test_cleanup_specific_minimal_input_initial_resources_exists
|
||||
input:
|
||||
state: cleanup
|
||||
name: virtual-ip
|
||||
output:
|
||||
changed: true
|
||||
previous_value: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
value: "NO resources configured"
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, resource, status, virtual-ip]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, cleanup, virtual-ip]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Cleaned up virtual-ip on X"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, status, virtual-ip]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "NO resources configured"
|
||||
err: ""
|
|
@ -51,6 +51,63 @@ test_cases:
|
|||
rc: 0
|
||||
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
err: ""
|
||||
- id: test_present_filled_input_resource_not_exist
|
||||
input:
|
||||
state: present
|
||||
name: virtual-ip
|
||||
resource_type:
|
||||
resource_name: IPaddr2
|
||||
resource_option:
|
||||
- "ip=[192.168.2.1]"
|
||||
resource_operation:
|
||||
- operation_action: start
|
||||
operation_option:
|
||||
- timeout=1200
|
||||
- operation_action: stop
|
||||
operation_option:
|
||||
- timeout=1200
|
||||
- operation_action: monitor
|
||||
operation_option:
|
||||
- timeout=1200
|
||||
resource_meta:
|
||||
- test_meta1=123
|
||||
- test_meta2=456
|
||||
resource_argument:
|
||||
argument_action: group
|
||||
argument_option:
|
||||
- test_group
|
||||
wait: 200
|
||||
output:
|
||||
changed: true
|
||||
previous_value: null
|
||||
value: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/pcs, resource, status, virtual-ip]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: ""
|
||||
err: "Error: resource or tag id 'virtual-ip' not found"
|
||||
- command: [/testbin/pcs, property, config]
|
||||
environ: *env-def
|
||||
rc: 1
|
||||
out: |
|
||||
Cluster Properties: cib-bootstrap-options
|
||||
cluster-infrastructure=corosync
|
||||
cluster-name=hacluster
|
||||
dc-version=2.1.9-1.fc41-7188dbf
|
||||
have-watchdog=false
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, create, virtual-ip, IPaddr2, "ip=[192.168.2.1]", op, start, timeout=1200, op, stop, timeout=1200, op, monitor, timeout=1200, meta, test_meta1=123, meta, test_meta2=456, --group, test_group, --wait=200]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "Assumed agent name 'ocf:heartbeat:IPaddr2' (deduced from 'IPAddr2')"
|
||||
err: ""
|
||||
- command: [/testbin/pcs, resource, status, virtual-ip]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
|
||||
err: ""
|
||||
- id: test_present_minimal_input_resource_exists
|
||||
input:
|
||||
state: present
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue