Updating unit and integration tests for beacons to reflect changes.

This commit is contained in:
Gareth J. Greenaway 2017-07-16 10:35:36 -07:00
parent ff6f42405f
commit d8ac1f8cfb
2 changed files with 6 additions and 4 deletions

View file

@ -35,7 +35,7 @@ class BeaconsAddDeleteTest(ModuleCase):
'''
Test adding and deleting a beacon
'''
_add = self.run_function('beacons.add', ['ps', [{'apache2': 'stopped'}]])
_add = self.run_function('beacons.add', ['ps', [{'processes': {'apache2': 'stopped'}}]])
self.assertTrue(_add['result'])
# save added beacon
@ -71,7 +71,7 @@ class BeaconsTest(ModuleCase):
self.__class__.beacons_config_file_path = os.path.join(self.minion_conf_d_dir, 'beacons.conf')
try:
# Add beacon to disable
self.run_function('beacons.add', ['ps', [{'apache2': 'stopped'}]])
self.run_function('beacons.add', ['ps', [{'processes': {'apache2': 'stopped'}}]])
self.run_function('beacons.save')
except CommandExecutionError:
self.skipTest('Unable to add beacon')
@ -143,6 +143,6 @@ class BeaconsTest(ModuleCase):
# list beacons
ret = self.run_function('beacons.list', return_yaml=False)
if 'enabled' in ret:
self.assertEqual(ret, {'ps': [{'apache2': 'stopped'}], 'enabled': True})
self.assertEqual(ret, {'ps': [{'processes': {'apache2': 'stopped'}}], 'enabled': True})
else:
self.assertEqual(ret, {'ps': {'apache': 'stopped'}})
self.assertEqual(ret, {'ps': [{'processes': {'apache2': 'stopped'}}]})

View file

@ -58,6 +58,7 @@ class ServiceBeaconTestCase(TestCase, LoaderModuleMockMixin):
ret = service_beacon.beacon(config)
self.assertEqual(ret, [{'service_name': 'salt-master',
'tag': 'salt-master',
'salt-master': {'running': True}}])
def test_service_not_running(self):
@ -71,4 +72,5 @@ class ServiceBeaconTestCase(TestCase, LoaderModuleMockMixin):
ret = service_beacon.beacon(config)
self.assertEqual(ret, [{'service_name': 'salt-master',
'tag': 'salt-master',
'salt-master': {'running': False}}])