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
ISC Open Source Projects
Kea
Commits
df25eeda
Commit
df25eeda
authored
Feb 01, 2012
by
Jelte Jansen
Browse files
[640] additional tests
parent
4e8a4299
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/bin/bind10/bind10_src.py.in
View file @
df25eeda
...
...
@@ -674,14 +674,19 @@ class BoB:
if not self.__started:
raise Exception("Component failed during startup");
else:
if self.ccs is not None:
self.ccs.stop()
self.runnable = False
def shutdown(self):
"""Stop the BoB instance."""
logger.info(BIND10_SHUTDOWN)
# first try using the BIND 10 request to stop
# If ccsession is still there, inform rest of the system this module
# is stopping. Since everything will be stopped shortly, this is not
# really necessary, but this is done to reflect that boss is also
# 'just' a module.
if self.ccs is not None:
self.ccs.stop()
# try using the BIND 10 request to stop
try:
self._component_configurator.shutdown()
except:
...
...
src/bin/bind10/tests/bind10_test.py.in
View file @
df25eeda
...
...
@@ -103,6 +103,14 @@ class TestProcessInfo(unittest.TestCase):
self.assertTrue(type(pi.pid) is int)
self.assertNotEqual(pi.pid, old_pid)
class MockCCSession:
"""Simple test class to check whether 'shutdown' calls stop()"""
def __init__(self):
self.stopped = False
def stop(self):
self.stopped = True
class TestCacheCommands(unittest.TestCase):
"""
Test methods of boss related to the socket cache and socket handling.
...
...
@@ -1171,8 +1179,12 @@ class TestBossComponents(unittest.TestCase):
bob._component_configurator.shutdown = self.__nullary_hook
self.__called = False
bob.ccs = MockCCSession()
self.assertFalse(bob.ccs.stopped)
bob.shutdown()
self.assertTrue(bob.ccs.stopped)
self.assertEqual([False, True], killed)
self.assertTrue(self.__called)
...
...
src/bin/stats/tests/b10-stats-httpd_test.py
View file @
df25eeda
...
...
@@ -37,7 +37,9 @@ import random
import
isc
import
stats_httpd
import
stats
from
test_utils
import
BaseModules
,
ThreadingServerManager
,
MyStats
,
MyStatsHttpd
,
SignalHandler
,
send_command
,
send_shutdown
from
test_utils
import
BaseModules
,
ThreadingServerManager
,
MyStats
,
\
MyStatsHttpd
,
SignalHandler
,
MyModuleCCSession
,
\
send_command
,
send_shutdown
DUMMY_DATA
=
{
'Boss'
:
{
...
...
@@ -676,7 +678,13 @@ class TestStatsHttpd(unittest.TestCase):
def
test_openclose_mccs
(
self
):
self
.
stats_httpd
=
MyStatsHttpd
(
get_availaddr
())
mccs
=
MyModuleCCSession
()
self
.
stats_httpd
.
mccs
=
mccs
self
.
assertFalse
(
self
.
stats_httpd
.
mccs
.
stopped
)
self
.
assertFalse
(
self
.
stats_httpd
.
mccs
.
closed
)
self
.
stats_httpd
.
close_mccs
()
self
.
assertTrue
(
mccs
.
stopped
)
self
.
assertTrue
(
mccs
.
closed
)
self
.
assertEqual
(
self
.
stats_httpd
.
mccs
,
None
)
self
.
stats_httpd
.
open_mccs
()
self
.
assertIsNotNone
(
self
.
stats_httpd
.
mccs
)
...
...
src/bin/stats/tests/test_utils.py
View file @
df25eeda
...
...
@@ -349,6 +349,17 @@ class MyStats(stats.Stats):
def
shutdown
(
self
):
self
.
command_shutdown
()
class
MyModuleCCSession
():
def
__init__
(
self
):
self
.
stopped
=
False
self
.
closed
=
False
def
stop
(
self
):
self
.
stopped
=
True
def
close
(
self
):
self
.
closed
=
True
class
MyStatsHttpd
(
stats_httpd
.
StatsHttpd
):
ORIG_SPECFILE_LOCATION
=
stats_httpd
.
SPECFILE_LOCATION
def
__init__
(
self
,
*
server_address
):
...
...
src/lib/python/isc/config/tests/config_data_test.py
View file @
df25eeda
...
...
@@ -312,6 +312,16 @@ class TestMultiConfigData(unittest.TestCase):
self
.
mcd
.
remove_specification
(
module_spec
.
get_module_name
())
self
.
assertFalse
(
self
.
mcd
.
have_specification
(
module_spec
.
get_module_name
()))
def
test_clear_specifications
(
self
):
self
.
assertEqual
(
0
,
len
(
self
.
mcd
.
_specifications
))
module_spec
=
isc
.
config
.
module_spec_from_file
(
self
.
data_path
+
os
.
sep
+
"spec1.spec"
)
self
.
mcd
.
set_specification
(
module_spec
)
self
.
assertEqual
(
1
,
len
(
self
.
mcd
.
_specifications
))
self
.
mcd
.
clear_specifications
()
self
.
assertEqual
(
0
,
len
(
self
.
mcd
.
_specifications
))
def
test_get_module_spec
(
self
):
module_spec
=
isc
.
config
.
module_spec_from_file
(
self
.
data_path
+
os
.
sep
+
"spec1.spec"
)
self
.
mcd
.
set_specification
(
module_spec
)
...
...
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