mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #25710 from jahamn/integration-test-for-issue-25250
Integration Testcase for Issue 25250
This commit is contained in:
commit
fb4744b2f8
1 changed files with 17 additions and 0 deletions
|
@ -1727,6 +1727,23 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
|||
finally:
|
||||
os.remove(source)
|
||||
|
||||
def test_issue_25250_force_copy_deletes(self):
|
||||
'''
|
||||
ensure force option in copy state does not delete target file
|
||||
'''
|
||||
dest = os.path.join(integration.TMP, 'dest')
|
||||
source = os.path.join(integration.TMP, 'source')
|
||||
shutil.copyfile(os.path.join(integration.FILES, 'hosts'), source)
|
||||
shutil.copyfile(os.path.join(integration.FILES, 'file/base/cheese'), dest)
|
||||
|
||||
self.run_state('file.copy', name=dest, source=source, force=True)
|
||||
self.assertTrue(os.path.exists(dest))
|
||||
self.assertTrue(filecmp.cmp(source, dest))
|
||||
|
||||
os.remove(source)
|
||||
os.remove(dest)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(FileTest)
|
||||
|
|
Loading…
Add table
Reference in a new issue