import unittest
import os
from isc.testutils.tsigctx_mock import MockTSIGContext
+from isc.testutils.ccsession_mock import MockModuleCCSession
from isc.cc.session import *
import isc.config
from isc.dns import *
xfrout.init_paths()
self.assertEqual(xfrout.UNIX_SOCKET_FILE, "The/Socket/File")
+class MyNotifier():
+ def __init__(self):
+ self.shutdown_called = False
+
+ def shutdown(self):
+ self.shutdown_called = True
+
+class MyXfroutServer(XfroutServer):
+ def __init__(self):
+ self._cc = MockModuleCCSession()
+ self._shutdown_event = threading.Event()
+ self._notifier = MyNotifier()
+ self._unix_socket_server = None
+
+class TestXfroutServer(unittest.TestCase):
+ def setUp(self):
+ self.xfrout_server = MyXfroutServer()
+
+ def test_shutdown(self):
+ self.xfrout_server.shutdown()
+ self.assertTrue(self.xfrout_server._notifier.shutdown_called)
+ self.assertTrue(self.xfrout_server._cc.stopped)
+
+
if __name__== "__main__":
isc.log.resetUnitTestRootLogger()
unittest.main()
if self._unix_socket_server:
self._unix_socket_server.shutdown()
- # Wait for all threads to terminate
- main_thread = threading.currentThread()
- for th in threading.enumerate():
- if th is main_thread:
- continue
- th.join()
+ # Wait for all threads to terminate
+ main_thread = threading.currentThread()
+ for th in threading.enumerate():
+ if th is main_thread:
+ continue
+ th.join()
def command_handler(self, cmd, args):
if cmd == "shutdown":