mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
20ed2c6bcf
* salt/cloud/__init__.py: remove repr formatting * salt/cloud/clouds/azurearm.py: remove repr formatting * salt/cloud/clouds/ec2.py: remove repr formatting * salt/cloud/clouds/profitbricks.py: remove repr formatting * salt/loader.py: remove repr formatting * salt/modules/win_file.py: remove repr formatting * salt/modules/zypper.py: remove repr formatting * salt/pillar/consul_pillar.py: remove repr formatting * salt/renderers/pyobjects.py: remove repr formatting * salt/returners/sentry_return.py: remove repr formatting * salt/states/bower.py: remove repr formatting * salt/states/cabal.py: remove repr formatting * salt/states/cmd.py: remove repr formatting * salt/states/composer.py: remove repr formatting * salt/states/win_network.py: remove repr formatting * salt/states/eselect.py: remove repr formatting * salt/states/file.py: remove repr formatting * salt/states/htpasswd.py: remove repr formatting * salt/states/memcached.py: remove repr formatting * salt/states/npm.py: remove repr formatting * salt/states/pip_state.py: remove repr formatting * salt/states/pkg.py: remove repr formatting * salt/states/pkgrepo.py: remove repr formatting * salt/states/supervisord.py: remove repr formatting * salt/states/timezone.py: remove repr formatting * salt/states/virtualenv_mod.py: remove repr formatting * salt/states/dockerio.py: remove repr formatting * salt/states/win_system.py: remove repr formatting * salt/utils/nb_popen.py: remove repr formatting * salt/utils/cloud.py: remove repr formatting * Add pylint disable due to legit usage of repr flag See https://github.com/saltstack/salt-pylint/pull/6 * Fix composer tests These tests needed to be updated because quoting was changed in the state module in 9dc9146. There was an unnecessary !r used for the exception class there, which means that instead of the exception class being passed through the formatter and coming out with the equivalent value of err.__str__(), we get a repr'ed instance of the exception class (i.e. SaltException('',)) in the state output. The unit test was asserting that we have that repr'ed instance of SaltException in the output, a case of writing the test to confirm the badly-conceived output in the state. This has also been corrected. * salt/cloud/clouds/azurearm.py: lint fixes * salt/modules/boto_s3_bucket.py: lint fixes * salt/modules/minion.py: lint fixes * salt/modules/reg.py: lint fixes * salt/modules/testinframod.py: lint fixes * salt/modules/win_iis.py: lint fixes * salt/pillar/csvpillar.py: lint fixes * salt/utils/win_functions.py: lint fixes * salt/states/nxos.py: lint fixes * salt/returners/mongo_future_return.py: lint fixes * tests/integration/__init__.py: lint fixes * tests/unit/context_test.py: lint fixes * tests/integration/states/file.py: lint fixes * tests/integration/utils/test_reactor.py: lint fixes * tests/integration/utils/testprogram.py: lint fixes * tests/unit/__init__.py: lint fixes * tests/integration/shell/minion.py: lint fixes * tests/unit/modules/boto_apigateway_test.py: lint fixes * tests/unit/modules/boto_cognitoidentity_test.py: lint fixes * tests/unit/modules/boto_elasticsearch_domain_test.py: lint fixes * tests/unit/modules/k8s_test.py: lint fixes * tests/unit/modules/reg_win_test.py: lint fixes * tests/unit/states/boto_apigateway_test.py: lint fixes * tests/unit/states/boto_cognitoidentity_test.py: lint fixes * tests/unit/states/boto_elasticsearch_domain_test.py: lint fixes
70 lines
1.8 KiB
Python
70 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import absolute_import
|
|
import time
|
|
import shutil
|
|
import tempfile
|
|
import os
|
|
|
|
from contextlib import contextmanager
|
|
|
|
import integration
|
|
|
|
from salt.utils.process import clean_proc
|
|
from salt.utils import event
|
|
|
|
from salttesting.mock import patch
|
|
|
|
|
|
@contextmanager
|
|
def reactor_process(opts, reactor):
|
|
opts = dict(opts)
|
|
opts['reactor'] = reactor
|
|
proc = event.Reactor(opts)
|
|
proc.start()
|
|
try:
|
|
if os.environ.get('TRAVIS_PYTHON_VERSION', None) is not None:
|
|
# Travis is slow
|
|
time.sleep(10)
|
|
else:
|
|
time.sleep(2)
|
|
yield
|
|
finally:
|
|
clean_proc(proc)
|
|
|
|
|
|
@contextmanager
|
|
def _args_sideffect(*args, **kwargs):
|
|
return args, kwargs
|
|
|
|
|
|
class TestReactor(integration.ModuleCase):
|
|
def setUp(self):
|
|
self.opts = self.get_config('master', from_scratch=True)
|
|
self.tempdir = tempfile.mkdtemp(dir=integration.SYS_TMP_DIR)
|
|
self.sls_name = os.path.join(self.tempdir, 'test.sls')
|
|
with open(self.sls_name, 'w') as fh:
|
|
fh.write('''
|
|
update_fileserver:
|
|
runner.fileserver.update
|
|
''')
|
|
|
|
def tearDown(self):
|
|
if os.path.isdir(self.tempdir):
|
|
shutil.rmtree(self.tempdir)
|
|
|
|
def test_basic(self):
|
|
reactor_config = [
|
|
{'salt/tagA': ['/srv/reactor/A.sls']},
|
|
{'salt/tagB': ['/srv/reactor/B.sls']},
|
|
{'*': ['/srv/reactor/all.sls']},
|
|
]
|
|
wrap = event.ReactWrap(self.opts)
|
|
with patch('salt.utils.event.ReactWrap.local', _args_sideffect):
|
|
ret = wrap.run({'fun': 'test.ping',
|
|
'state': 'local',
|
|
'order': 1,
|
|
'name': 'foo_action',
|
|
'__id__': 'foo_action'})
|
|
raise Exception(ret)
|