mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
add changelog and tests for saltcheck fixes
This commit is contained in:
parent
95e011d25d
commit
b8d5acc619
3 changed files with 84 additions and 0 deletions
1
changelog/62398.fixed
Normal file
1
changelog/62398.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Fix ability to execute remote file client methods in saltcheck
|
1
changelog/62523.fixed
Normal file
1
changelog/62523.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Fix rendering of pyobjects states in saltcheck
|
82
tests/pytests/integration/modules/test_saltcheck.py
Normal file
82
tests/pytests/integration/modules/test_saltcheck.py
Normal file
|
@ -0,0 +1,82 @@
|
|||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_saltcheck_render_pyobjects_state(salt_master, salt_call_cli):
|
||||
with pytest.helpers.temp_file("pyobj_touched.txt") as tpath:
|
||||
sls_content = """
|
||||
#!pyobjects
|
||||
|
||||
File.touch("{}")
|
||||
""".format(
|
||||
tpath
|
||||
)
|
||||
|
||||
tst_content = """
|
||||
is_stuff_there:
|
||||
module_and_function: file.file_exists
|
||||
args:
|
||||
- "{}"
|
||||
assertion: assertTrue
|
||||
""".format(
|
||||
tpath
|
||||
)
|
||||
|
||||
with salt_master.state_tree.base.temp_file(
|
||||
"pyobj_touched/init.sls", sls_content
|
||||
):
|
||||
with salt_master.state_tree.base.temp_file(
|
||||
"pyobj_touched/saltcheck-tests/init.tst", tst_content
|
||||
):
|
||||
ret = salt_call_cli.run(
|
||||
"--local",
|
||||
"saltcheck.run_state_tests",
|
||||
"pyobj_touched",
|
||||
)
|
||||
assert (
|
||||
ret.data[0]["pyobj_touched"]["is_stuff_there"]["status"] == "Pass"
|
||||
)
|
||||
assert ret.data[1]["TEST RESULTS"]["Passed"] == 1
|
||||
assert ret.data[1]["TEST RESULTS"]["Missing Tests"] == 0
|
||||
assert ret.data[1]["TEST RESULTS"]["Failed"] == 0
|
||||
assert ret.data[1]["TEST RESULTS"]["Skipped"] == 0
|
||||
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_saltcheck_allow_remote_fileclient(salt_master, salt_call_cli):
|
||||
sls_content = """
|
||||
test_state:
|
||||
test.show_notification:
|
||||
- text: The test state
|
||||
"""
|
||||
|
||||
tst_content = """
|
||||
test cp.cache_file:
|
||||
module_and_function: cp.cache_file
|
||||
args:
|
||||
- salt://sltchk_remote/download_me.txt
|
||||
kwargs:
|
||||
saltenv: base
|
||||
assertion: assertNotEmpty
|
||||
output_details: True
|
||||
"""
|
||||
|
||||
with salt_master.state_tree.base.temp_file("sltchk_remote/init.sls", sls_content):
|
||||
with salt_master.state_tree.base.temp_file(
|
||||
"sltchk_remote/saltcheck-tests/init.tst", tst_content
|
||||
):
|
||||
with salt_master.state_tree.base.temp_file(
|
||||
"sltchk_remote/download_me.txt", "salty"
|
||||
):
|
||||
ret = salt_call_cli.run(
|
||||
"saltcheck.run_state_tests",
|
||||
"sltchk_remote",
|
||||
)
|
||||
assert (
|
||||
ret.data[0]["sltchk_remote"]["test cp.cache_file"]["status"]
|
||||
== "Pass"
|
||||
)
|
||||
assert ret.data[1]["TEST RESULTS"]["Passed"] == 1
|
||||
assert ret.data[1]["TEST RESULTS"]["Missing Tests"] == 0
|
||||
assert ret.data[1]["TEST RESULTS"]["Failed"] == 0
|
||||
assert ret.data[1]["TEST RESULTS"]["Skipped"] == 0
|
Loading…
Add table
Reference in a new issue