Update tests to run an extra master and a syndic

This commit is contained in:
Thomas S Hatch 2012-03-28 22:14:31 -06:00
parent 1e63ffc862
commit f06ea9335d

View file

@ -34,6 +34,13 @@ class TestDaemon(object):
os.path.join(INTEGRATION_TEST_DIR, 'files/conf/master'))
self.minion_opts = salt.config.minion_config(
os.path.join(INTEGRATION_TEST_DIR, 'files/conf/minion'))
self.smaster_opts = salt.config.master_config(
os.path.join(INTEGRATION_TEST_DIR, 'files/conf/syndic_master'))
self.syndic_opts = salt.config.master_config(
os.path.join(INTEGRATION_TEST_DIR, 'files/conf/master'))
self.syndic_opts.update(self.minion_opts)
self.syndic_opts['master_port'] = '74506'
self.syndic_opts['_master_conf_file'] = self.master_opts['conf_file']
# clean up the old files
if os.path.isdir(self.master_opts['root_dir']):
shutil.rmtree(self.master_opts['root_dir'])
@ -41,13 +48,19 @@ class TestDaemon(object):
self.master_opts['hosts.file'] = os.path.join(TMP, 'hosts')
self.minion_opts['file_roots'] = FILES
self.minion_opts['hosts.file'] = os.path.join(TMP, 'hosts')
verify_env([os.path.join(self.master_opts['pki_dir'], 'minions'),
verify_env([
os.path.join(self.master_opts['pki_dir'], 'minions'),
os.path.join(self.master_opts['pki_dir'], 'minions_pre'),
os.path.join(self.master_opts['pki_dir'], 'minions_rejected'),
os.path.join(self.master_opts['cachedir'], 'jobs'),
os.path.join(self.smaster_opts['pki_dir'], 'minions'),
os.path.join(self.smaster_opts['pki_dir'], 'minions_pre'),
os.path.join(self.smaster_opts['pki_dir'], 'minions_rejected'),
os.path.join(self.smaster_opts['cachedir'], 'jobs'),
os.path.dirname(self.master_opts['log_file']),
self.minion_opts['extension_modules'],
self.master_opts['sock_dir'],
self.smaster_opts['sock_dir'],
])
master = salt.master.Master(self.master_opts)
@ -58,8 +71,22 @@ class TestDaemon(object):
self.minion_process = multiprocessing.Process(target=minion.tune_in)
self.minion_process.start()
smaster = salt.master.Master(self.smaster_opts)
self.smaster_process = multiprocessing.Process(target=smaster.start)
self.smaster_process.start()
syndic = salt.minion.Syndic(self.syndic_opts)
self.syndic_process = multiprocessing.Process(target=syndic.tune_in)
self.syndic_process.start()
return self
def __exit__(self, type, value, traceback):
'''
Kill the minion and master processes
'''
self.syndic_process.terminate()
self.master_process.terminate()
def __exit__(self, type, value, traceback):
'''
@ -68,6 +95,8 @@ class TestDaemon(object):
self.minion_process.terminate()
self.stop_master_processes()
self.master_process.terminate()
self.syndic_process.terminate()
self.smaster_process.terminate()
def stop_master_processes(self):