Add integration test for the running dictionary structure

This will fail if we remove/rename any fields from the running
dictionary by accident.
This commit is contained in:
Seth House 2016-12-05 13:42:16 -07:00
parent 0af51fd086
commit e4cf3931b3

View file

@ -74,6 +74,31 @@ class StateModuleTest(integration.ModuleCase,
sls = self.run_function('state.show_sls', mods='recurse_ok_two')
self.assertIn('/etc/nagios/nrpe.cfg', sls)
def test_running_dictionary_consistency(self):
'''
Test the structure of the running dictionary so we don't change it
without deprecating/documenting the change
'''
running_dict_fields = [
'__id__',
'__run_num__',
'__sls__',
'changes',
'comment',
'duration',
'name',
'result',
'start_time',
]
sls = self.run_function('state.single',
fun='test.succeed_with_changes',
name='gndn')
for state, ret in sls.items():
for field in running_dict_fields:
self.assertIn(field, ret)
def _remove_request_cache_file(self):
'''
remove minion state request file