mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 23:14:02 -07:00
[PR #10227/283d947f backport][stable-11] pacemaker_cluster: enhancements and add unit tests (#10408)
pacemaker_cluster: enhancements and add unit tests (#10227)
* 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
* 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
* refactor(review): Add changelog and revert required name
* revert(default): Use default state=present
* Update changelogs/fragments/10227-pacemaker-cluster-and-resource-enhancement.yml
* Update changelog fragment.
---------
(cherry picked from commit 283d947f17
)
Co-authored-by: Dexter <45038532+munchtoast@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
115f4b5c51
commit
ffa1436f05
8 changed files with 695 additions and 156 deletions
|
@ -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