Browse Source

[2582] Lettuce tests for msgq logging

This way we check the logging works to the correct place and that the
configuration is handled. It is better checked by lettuce than unit
tests, since there's a lot of inter-module communication in it.
Michal 'vorner' Vaner 12 years ago
parent
commit
b0a6e5fff9
3 changed files with 19 additions and 2 deletions
  1. 1 1
      src/bin/msgq/msgq.py.in
  2. 0 1
      src/bin/msgq/tests/msgq_test.py
  3. 18 0
      tests/lettuce/features/msgq.feature

+ 1 - 1
src/bin/msgq/msgq.py.in

@@ -40,7 +40,7 @@ import isc.cc
 
 isc.util.process.rename()
 
-isc.log.init("b10-msgq")
+isc.log.init("b10-msgq", buffer=True)
 # Logger that is used in the actual msgq handling - startup, shutdown and the
 # poller thread.
 logger = isc.log.Logger("msgq")

+ 0 - 1
src/bin/msgq/tests/msgq_test.py

@@ -562,6 +562,5 @@ class ThreadTests(unittest.TestCase):
         self.assertTrue(self.__result)
 
 if __name__ == '__main__':
-    isc.log.init("b10-msgq")
     isc.log.resetUnitTestRootLogger()
     unittest.main()

+ 18 - 0
tests/lettuce/features/msgq.feature

@@ -0,0 +1,18 @@
+Feature: Message queue tests
+    Tests for the message queue daemon.
+
+    Scenario: logging
+        # We check the message queue logs.
+        Given I have bind10 running with configuration default.config
+        And wait for bind10 stderr message BIND10_STARTED_CC
+        And wait for bind10 stderr message MSGQ_START
+        And wait for bind10 stderr message MSGQ_LISTENER_STARTED
+        And wait for bind10 stderr message MSGQ_CFGMGR_SUBSCRIBED
+        And wait for bind10 stderr message CMDCTL_STARTED
+
+        # Check it handles configuration. The configuration is invalid,
+        # but it should get there anyway and we abuse it.
+        # TODO: Once it has any kind of real command or configuration
+        # value, use that instead.
+        Then set bind10 configuration Msgq to {"nonsense": 1}
+        And wait for bind10 stderr message MSGQ_CONFIG_DATA