mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add regression test for issue 56131
This commit is contained in:
parent
9d23f55adc
commit
69b21e5e68
3 changed files with 34 additions and 0 deletions
10
tests/integration/files/file/base/issue-56131.sls
Normal file
10
tests/integration/files/file/base/issue-56131.sls
Normal file
|
@ -0,0 +1,10 @@
|
|||
# archive-test
|
||||
vault:
|
||||
archive.extracted:
|
||||
- name: {{ pillar['unzip_to'] }}
|
||||
- source: salt://issue-56131.zip
|
||||
- source_hash: sha256=4fc6f049d658a414aca066fb11c2109d05b59f082d707d5d6355b6c574d25720
|
||||
- archive_format: zip
|
||||
- enforce_toplevel: False
|
||||
- unless:
|
||||
- echo hello && 1
|
BIN
tests/integration/files/file/base/issue-56131.zip
Normal file
BIN
tests/integration/files/file/base/issue-56131.zip
Normal file
Binary file not shown.
|
@ -2268,3 +2268,27 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
self.assertEqual(state_run[state_id]['comment'],
|
||||
'Success!')
|
||||
self.assertTrue(state_run[state_id]['result'])
|
||||
|
||||
def test_issue_56131(self):
|
||||
module_path = os.path.join(RUNTIME_VARS.CODE_DIR, 'pip.py')
|
||||
if six.PY3:
|
||||
modulec_path = os.path.join(RUNTIME_VARS.CODE_DIR, '__pycache__', 'pip.pyc')
|
||||
else:
|
||||
modulec_path = os.path.join(RUNTIME_VARS.CODE_DIR, 'pip.pyc')
|
||||
print('*' * 80)
|
||||
print(module_path)
|
||||
print('*' * 80)
|
||||
unzip_path = os.path.join(RUNTIME_VARS.TMP, 'issue-56131.txt')
|
||||
def clean_paths(paths):
|
||||
for path in paths:
|
||||
try:
|
||||
os.remove(path)
|
||||
except OSError:
|
||||
log.warn("Path not found: %s", path)
|
||||
with open(module_path, 'w') as fp:
|
||||
fp.write('raise ImportError("No module named pip")')
|
||||
self.addCleanup(clean_paths, [unzip_path, module_path, modulec_path])
|
||||
assert not os.path.exists(unzip_path)
|
||||
state_run = self.run_function('state.sls', mods='issue-56131', pillar={'unzip_to': RUNTIME_VARS.TMP}, timeout=30)
|
||||
assert state_run is not False
|
||||
assert os.path.exists(unzip_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue