Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
e6ebe1de
Commit
e6ebe1de
authored
Dec 06, 2012
by
Mukund Sivaraman
Browse files
[2353] Check that BoB.start_msgq() calls isc.cc.Session() and group_subscribe()
parent
de66fdd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bind10/tests/bind10_test.py.in
View file @
e6ebe1de
...
@@ -1613,8 +1613,6 @@ class TestBossComponents(unittest.TestCase):
...
@@ -1613,8 +1613,6 @@ class TestBossComponents(unittest.TestCase):
bob.c_channel_env = {}
bob.c_channel_env = {}
# keep the timeout small for the test to complete quickly
# keep the timeout small for the test to complete quickly
bob.msgq_timeout = 1
bob.msgq_timeout = 1
# specifically set this to False so that the connect is
# attempted
bob.run_under_unittests = False
bob.run_under_unittests = False
# use the MockProcessInfo creator
# use the MockProcessInfo creator
...
@@ -1637,6 +1635,17 @@ class TestBossComponents(unittest.TestCase):
...
@@ -1637,6 +1635,17 @@ class TestBossComponents(unittest.TestCase):
time.time = _my_time
time.time = _my_time
time.sleep = _my_sleep
time.sleep = _my_sleep
global cc_sub
cc_sub = None
class DummySessionAlwaysFails():
def __init__(self, socket_file):
raise isc.cc.session.SessionError('Connection fails')
def group_subscribe(self, s):
global cc_sub
cc_sub = s
isc.cc.Session = DummySessionAlwaysFails
with self.assertRaises(bind10_src.CChannelConnectError):
with self.assertRaises(bind10_src.CChannelConnectError):
# An exception will be thrown here when it eventually times
# An exception will be thrown here when it eventually times
# out.
# out.
...
@@ -1647,7 +1656,36 @@ class TestBossComponents(unittest.TestCase):
...
@@ -1647,7 +1656,36 @@ class TestBossComponents(unittest.TestCase):
# to happen inside start_msgq().
# to happen inside start_msgq().
self.assertEqual(attempts, 13)
self.assertEqual(attempts, 13)
# time.time() and time.sleep() are restored during tearDown().
# group_subscribe() should not have been called here.
self.assertIsNone(cc_sub)
global cc_socket_file
cc_socket_file = None
cc_sub = None
class DummySession():
def __init__(self, socket_file):
global cc_socket_file
cc_socket_file = socket_file
def group_subscribe(self, s):
global cc_sub
cc_sub = s
isc.cc.Session = DummySession
# reset values
attempts = 0
tsec = 0
pi = bob.start_msgq()
# just one attempt, but 2 calls to time.time()
self.assertEqual(attempts, 2)
self.assertEqual(cc_socket_file, bob.msgq_socket_file)
self.assertEqual(cc_sub, 'Boss')
# isc.cc.Session, time.time() and time.sleep() are restored
# during tearDown().
def test_start_cfgmgr(self):
def test_start_cfgmgr(self):
'''Test that b10-cfgmgr is started.'''
'''Test that b10-cfgmgr is started.'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment