Merge pull request #1521 from dcolish/develop

Fix host file setup and fix tests.integration.states.host
This commit is contained in:
Thomas S Hatch 2012-06-30 12:00:05 -07:00
commit 65d8cb4e59
2 changed files with 9 additions and 4 deletions

View File

@ -74,6 +74,10 @@ class TestDaemon(object):
self._clean()
self.master_opts['hosts.file'] = os.path.join(TMP, 'hosts')
self.minion_opts['hosts.file'] = os.path.join(TMP, 'hosts')
shutil.copy(os.path.join(INTEGRATION_TEST_DIR, 'files', 'hosts'),
self.master_opts['hosts.file'])
shutil.copy(os.path.join(INTEGRATION_TEST_DIR, 'files', 'hosts'),
self.minion_opts['hosts.file'])
verify_env([
os.path.join(self.master_opts['pki_dir'], 'minions'),
os.path.join(self.master_opts['pki_dir'], 'minions_pre'),

View File

@ -6,9 +6,7 @@ tests for host state
import os
#
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon
HFILE = os.path.join(integration.TMP, 'hosts')
@ -21,8 +19,11 @@ class HostTest(integration.ModuleCase):
'''
host.present
'''
ret = self.run_state('host.present', name='spam.bacon', ip='10.10.10.10')
name = 'spam.bacon'
ip = '10.10.10.10'
ret = self.run_state('host.present', name=name, ip=ip)
result = self.state_result(ret)
self.assertTrue(result)
with open(HFILE) as fp_:
self.assertIn('{0}\t\t{1}'.format(ip, name), fp_.read())
output = fp_.read()
self.assertIn('{0}\t\t{1}'.format(ip, name), output)