mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add new unit tests for ansible.playbooks with skipped targets
This commit is contained in:
parent
60e85eaf01
commit
5253882e2c
2 changed files with 1350 additions and 0 deletions
|
@ -42,6 +42,36 @@ def test_ansible_playbooks_states_success(playbooks_examples_dir):
|
|||
}
|
||||
|
||||
|
||||
def test_ansible_playbooks_states_success_with_skipped(playbooks_examples_dir):
|
||||
"""
|
||||
Test ansible.playbooks states executions success.
|
||||
"""
|
||||
|
||||
success_output = json.loads(
|
||||
playbooks_examples_dir.joinpath("success_example_with_skipped.json").read_text()
|
||||
)
|
||||
|
||||
with patch.dict(
|
||||
ansiblegate.__salt__,
|
||||
{"ansible.playbooks": MagicMock(return_value=success_output)},
|
||||
), patch("salt.utils.path.which", return_value=True), patch.dict(
|
||||
ansiblegate.__opts__, {"test": False}
|
||||
):
|
||||
ret = ansiblegate.playbooks("foobar")
|
||||
assert ret["result"] is True
|
||||
assert ret["comment"] == "No changes to be made from playbook foobar"
|
||||
assert ret["changes"] == {
|
||||
"all": {
|
||||
"install git CentOS": {"uyuni-stable-min-sles15sp3.tf.local": {}},
|
||||
"install git SUSE": {"uyuni-stable-min-centos7.tf.local": {}},
|
||||
"install git Ubuntu": {
|
||||
"uyuni-stable-min-centos7.tf.local": {},
|
||||
"uyuni-stable-min-sles15sp3.tf.local": {},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def test_ansible_playbooks_states_failed(playbooks_examples_dir):
|
||||
"""
|
||||
Test ansible.playbooks failed states executions.
|
||||
|
|
1320
tests/unit/files/playbooks/success_example_with_skipped.json
Normal file
1320
tests/unit/files/playbooks/success_example_with_skipped.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue