mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #45371 from rallytime/bp-45158
Back-port #45158 to 2017.7
This commit is contained in:
commit
22c3efda06
@ -4,7 +4,6 @@ exclude:
|
||||
include:
|
||||
- include-test
|
||||
|
||||
{{ salt['runtests_helpers.get_salt_temp_dir_for_path']('exclude-test') }}:
|
||||
file:
|
||||
- managed
|
||||
{{ pillar['exclude-test'] }}:
|
||||
file.managed:
|
||||
- source: salt://testfile
|
||||
|
@ -1,7 +1,6 @@
|
||||
include:
|
||||
- to-include-test
|
||||
|
||||
{{ salt['runtests_helpers.get_salt_temp_dir_for_path']('include-test') }}:
|
||||
file:
|
||||
- managed
|
||||
{{ pillar['include-test'] }}:
|
||||
file.managed:
|
||||
- source: salt://testfile
|
||||
|
@ -8,7 +8,7 @@ test-state:
|
||||
salt.state:
|
||||
- tgt: '*'
|
||||
- sls:
|
||||
- include-test
|
||||
- orch.target-test
|
||||
|
||||
cmd.run:
|
||||
salt.function:
|
||||
|
@ -8,7 +8,7 @@ test-state:
|
||||
salt.state:
|
||||
- tgt: '*'
|
||||
- sls:
|
||||
- include-test
|
||||
- orch.target-test
|
||||
|
||||
cmd.run:
|
||||
salt.function:
|
||||
|
2
tests/integration/files/file/base/orch/target-test.sls
Normal file
2
tests/integration/files/file/base/orch/target-test.sls
Normal file
@ -0,0 +1,2 @@
|
||||
always_true:
|
||||
test.succeed_without_changes
|
@ -1,4 +1,3 @@
|
||||
{{ salt['runtests_helpers.get_salt_temp_dir_for_path']('to-include-test') }}:
|
||||
file:
|
||||
- managed
|
||||
{{ pillar['to-include-test'] }}:
|
||||
file.managed:
|
||||
- source: salt://testfile
|
||||
|
@ -4,6 +4,7 @@
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
@ -325,44 +326,28 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
os.unlink(testfile)
|
||||
|
||||
def test_include(self):
|
||||
fnames = (
|
||||
os.path.join(TMP, 'include-test'),
|
||||
os.path.join(TMP, 'to-include-test')
|
||||
)
|
||||
exclude_test_file = os.path.join(
|
||||
TMP, 'exclude-test'
|
||||
)
|
||||
try:
|
||||
ret = self.run_function('state.sls', mods='include-test')
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
for fname in fnames:
|
||||
self.assertTrue(os.path.isfile(fname))
|
||||
self.assertFalse(os.path.isfile(exclude_test_file))
|
||||
finally:
|
||||
for fname in list(fnames) + [exclude_test_file]:
|
||||
if os.path.isfile(fname):
|
||||
os.remove(fname)
|
||||
tempdir = tempfile.mkdtemp(dir=TMP)
|
||||
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
|
||||
pillar = {}
|
||||
for path in ('include-test', 'to-include-test', 'exclude-test'):
|
||||
pillar[path] = os.path.join(tempdir, path)
|
||||
ret = self.run_function('state.sls', mods='include-test', pillar=pillar)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
self.assertTrue(os.path.isfile(pillar['include-test']))
|
||||
self.assertTrue(os.path.isfile(pillar['to-include-test']))
|
||||
self.assertFalse(os.path.isfile(pillar['exclude-test']))
|
||||
|
||||
def test_exclude(self):
|
||||
fnames = (
|
||||
os.path.join(TMP, 'include-test'),
|
||||
os.path.join(TMP, 'exclude-test')
|
||||
)
|
||||
to_include_test_file = os.path.join(
|
||||
TMP, 'to-include-test'
|
||||
)
|
||||
try:
|
||||
ret = self.run_function('state.sls', mods='exclude-test')
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
for fname in fnames:
|
||||
self.assertTrue(os.path.isfile(fname))
|
||||
self.assertFalse(os.path.isfile(to_include_test_file))
|
||||
finally:
|
||||
for fname in list(fnames) + [to_include_test_file]:
|
||||
if os.path.isfile(fname):
|
||||
os.remove(fname)
|
||||
tempdir = tempfile.mkdtemp(dir=TMP)
|
||||
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
|
||||
pillar = {}
|
||||
for path in ('include-test', 'exclude-test', 'to-include-test'):
|
||||
pillar[path] = os.path.join(tempdir, path)
|
||||
ret = self.run_function('state.sls', mods='exclude-test', pillar=pillar)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
self.assertTrue(os.path.isfile(pillar['include-test']))
|
||||
self.assertTrue(os.path.isfile(pillar['exclude-test']))
|
||||
self.assertFalse(os.path.isfile(pillar['to-include-test']))
|
||||
|
||||
@skipIf(salt.utils.which_bin(KNOWN_BINARY_NAMES) is None, 'virtualenv not installed')
|
||||
def test_issue_2068_template_str(self):
|
||||
|
Loading…
Reference in New Issue
Block a user