Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test_file.py
  • Loading branch information
bertdawg76 authored Oct 16, 2025
commit 190e529c1c73e8a4710c6f7e863acc5d10366bb2
17 changes: 10 additions & 7 deletions tests/pytests/integration/modules/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,17 @@ def test_create_symlink_with_check_cmd(salt_call_cli, salt_master, tmp_path):
assert name.exists()
assert name.is_dir()

sls_contents = f"""
sls_contents = """
{name}/testing:
file.symlink:
- target: {symlink_file}
- user: cbert
- group: staff
- makedirs: true
- check_cmd: grep 'jaguar' {symlink_file}
"""
""".format(
name=name, symlink_file=symlink_file
)

sls_tempfile = salt_master.state_tree.base.temp_file(
"test_symlink.sls", sls_contents
Expand Down Expand Up @@ -264,7 +266,7 @@ def test_create_symlink_with_check_cmd_list(salt_call_cli, salt_master, tmp_path
assert name.exists()
assert name.is_dir()

sls_contents = f"""
sls_contents = """
{name}/testing:
file.symlink:
- target: {symlink_file}
Expand All @@ -273,12 +275,13 @@ def test_create_symlink_with_check_cmd_list(salt_call_cli, salt_master, tmp_path
- makedirs: true
- check_cmd:
- grep 'jaguar' {symlink_file}
- grep 'j' {symlink_file}
"""
- grep "j" {symlink_file}
""".format(
name=name, symlink_file=symlink_file
)

sls_tempfile = salt_master.state_tree.base.temp_file(
"test_symlink.sls",
sls_contents,
"test_symlink.sls", sls_contents,
)
with sls_tempfile:
ret = salt_call_cli.run("state.apply", "test_symlink")
Expand Down
Loading