mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #1521 from dcolish/develop
Fix host file setup and fix tests.integration.states.host
This commit is contained in:
commit
65d8cb4e59
@ -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'),
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user