Revert "Add test case"

This reverts commit 21ebbf155d.
This commit is contained in:
Pedro Algarvio 2024-02-27 08:12:51 +00:00
parent 89c3abf1ec
commit 856ac3545e

View file

@ -436,55 +436,3 @@ def test_issue_12209_follow_symlinks(
assert one_group_check == state_file_account.group.name
two_group_check = modules.file.get_group(str(twodir), follow_symlinks=False)
assert two_group_check == state_file_account.group.name
@pytest.mark.parametrize("backupname_isfile", [False, True])
def test_directory_backupname_force_test_mode_noclobber(
file, tmp_path, backupname_isfile
):
"""
Ensure that file.directory does not make changes when backupname is used
alongside force=True and test=True.
See https://github.com/saltstack/salt/issues/66049
"""
source_dir = tmp_path / "source_directory"
dest_dir = tmp_path / "dest_directory"
backupname = tmp_path / "backup_dir"
source_dir.mkdir()
dest_dir.symlink_to(source_dir.resolve())
if backupname_isfile:
backupname.touch()
assert backupname.is_file()
ret = file.directory(
name=str(dest_dir),
allow_symlink=False,
force=True,
backupname=str(backupname),
test=True,
)
# Confirm None result
assert ret.result is None
try:
# Confirm dest_dir not modified
assert dest_dir.readlink() == source_dir
except OSError:
pytest.fail(f"{dest_dir} was modified")
# Confirm that comment and changes match what we expect
assert (
ret.comment
== f"{dest_dir} would be backed up and replaced with a new directory"
)
assert ret.changes[str(dest_dir)] == {"directory": "new"}
assert ret.changes["backup"] == f"{dest_dir} would be renamed to {backupname}"
if backupname_isfile:
assert ret.changes["forced"] == (
f"Existing file at backup path {backupname} would be removed"
)
else:
assert "forced" not in ret.changes