mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Merge pull request #16149 from rallytime/improve_loader_test
Fix linode test failures and test all modules
This commit is contained in:
commit
227c62b4ee
@ -31,22 +31,23 @@ class LoaderGlobalsTest(integration.ModuleCase):
|
||||
Verify that the globals listed in the doc string (from the test) are in these modules
|
||||
'''
|
||||
# find the globals
|
||||
global_vars = None
|
||||
global_vars = []
|
||||
for val in mod_dict.itervalues():
|
||||
if hasattr(val, '__globals__'):
|
||||
global_vars = val.__globals__
|
||||
break
|
||||
# if we couldn't find any, then we have no modules-- so something is broken
|
||||
if global_vars is None:
|
||||
# TODO: log or something? Skip however we do that
|
||||
return
|
||||
# only find salty globals
|
||||
if val.__module__.startswith('salt.loaded') and hasattr(val, '__globals__'):
|
||||
global_vars.append(val.__globals__)
|
||||
|
||||
# if we couldn't find any, then we have no modules -- so something is broken
|
||||
self.assertNotEqual(global_vars, [], msg='No modules were loaded.')
|
||||
|
||||
# get the names of the globals you should have
|
||||
func_name = inspect.stack()[1][3]
|
||||
names = yaml.load(getattr(self, func_name).__doc__).values()[0]
|
||||
|
||||
for name in names:
|
||||
assert name in global_vars
|
||||
# Now, test each module!
|
||||
for item in global_vars:
|
||||
for name in names:
|
||||
self.assertIn(name, item)
|
||||
|
||||
def test_auth(self):
|
||||
'''
|
||||
@ -112,13 +113,6 @@ class LoaderGlobalsTest(integration.ModuleCase):
|
||||
'''
|
||||
self._verify_globals(salt.loader.states(self.master_opts, {}))
|
||||
|
||||
def test_log_handlers(self):
|
||||
'''
|
||||
Test that log_handlers have:
|
||||
- __path__
|
||||
'''
|
||||
self._verify_globals(salt.loader.log_handlers(self.master_opts))
|
||||
|
||||
def test_renderers(self):
|
||||
'''
|
||||
Test that renderers have:
|
||||
|
Loading…
Reference in New Issue
Block a user