Fixed tests, added log messages
This commit is contained in:
parent
faa689279f
commit
c30553ba74
@ -676,6 +676,8 @@ def switch_hosts_off(db, sleep_command, hosts):
|
||||
:type hosts: list(str)
|
||||
"""
|
||||
# TODO: implement running the sleep command over SSH
|
||||
if log.isEnabledFor(logging.INFO):
|
||||
log.info('Switch off hosts: %s', str(hosts))
|
||||
db.insert_host_states(dict((x, 0) for x in hosts))
|
||||
|
||||
|
||||
@ -689,4 +691,6 @@ def switch_hosts_on(db, hosts):
|
||||
:param hosts: A list of hosts to switch on.
|
||||
:type hosts: list(str)
|
||||
"""
|
||||
if log.isEnabledFor(logging.INFO):
|
||||
log.info('Switch on hosts: %s', str(hosts))
|
||||
db.insert_host_states(dict((x, 1) for x in hosts))
|
||||
|
@ -152,7 +152,9 @@ class GlobalManager(TestCase):
|
||||
def test_start(self):
|
||||
with MockTransaction:
|
||||
app = mock('app')
|
||||
state = {'property': 'value'}
|
||||
hosts = ['host1', 'host2']
|
||||
state = {'property': 'value',
|
||||
'compute_hosts': hosts}
|
||||
config = {
|
||||
'log_directory': 'dir',
|
||||
'log_level': 2,
|
||||
@ -165,6 +167,7 @@ class GlobalManager(TestCase):
|
||||
expect(common).init_logging('dir', 'global-manager.log', 2).once()
|
||||
expect(manager).init_state(config). \
|
||||
and_return(state).once()
|
||||
expect(manager).switch_hosts_on(hosts).once()
|
||||
expect(bottle).app().and_return(app).once()
|
||||
expect(bottle).run(host='localhost', port=8080).once()
|
||||
manager.start()
|
||||
|
Loading…
x
Reference in New Issue
Block a user