BIND 10 trac519, updated. 568a8cc472f3207b44b92428e7ac40338d9ede37 [519] Add unit test for the change to boss process. Catch the timeout exception when boss receiving the answer from stats.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Aug 18 08:39:12 UTC 2011


The branch, trac519 has been updated
       via  568a8cc472f3207b44b92428e7ac40338d9ede37 (commit)
      from  a53c7d7c450de09ceb04b47cb59450225827bd51 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 568a8cc472f3207b44b92428e7ac40338d9ede37
Author: zhanglikun <zhanglikun at cnnic.cn>
Date:   Thu Aug 18 16:37:15 2011 +0800

    [519] Add unit test for the change to boss process. Catch the timeout exception when boss receiving the answer from stats.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/bind10/bind10_src.py.in        |    5 ++++-
 src/bin/bind10/tests/bind10_test.py.in |    6 ++++++
 src/bin/stats/stats.py.in              |    4 +++-
 3 files changed, 13 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 5da78bf..81b24f1 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -329,7 +329,10 @@ class BoB:
                     'set', self._get_stats_data())
                 seq = self.cc_session.group_sendmsg(cmd, 'Stats')
                 # Consume the answer, in case it becomes a orphan message.
-                self.cc_session.group_recvmsg(False, seq) 
+                try:
+                    self.cc_session.group_recvmsg(False, seq)
+                except isc.cc.session.SessionTimeout:
+                    pass
                 answer = isc.config.ccsession.create_answer(0)
             elif command == "ping":
                 answer = isc.config.ccsession.create_answer(0, "pong")
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 077190c..424a610 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -147,6 +147,12 @@ class TestBoB(unittest.TestCase):
         self.assertEqual(bob.command_handler("shutdown", None),
                          isc.config.ccsession.create_answer(0))
         self.assertFalse(bob.runnable)
+        # "getstats" command
+        self.assertEqual(bob.command_handler("getstats", None),
+                         isc.config.ccsession.create_answer(0,
+                            { "stats_data": {
+                                'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
+                            }}))
         # "sendstats" command
         self.assertEqual(bob.command_handler("sendstats", None),
                          isc.config.ccsession.create_answer(0))
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 022900a..51d712b 100644
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -215,7 +215,9 @@ class CCSessionListener(Listener):
 
     def _update_stats_data(self, args):
         # 'args' must be dictionary type
-        self.stats_data.update(args['stats_data'])
+        if isinstance(args, dict) and isinstance(args.get('stats_data'), dict):
+            self.stats_data.update(args['stats_data'])
+
         # overwrite "stats.LastUpdateTime"
         self.stats_data['stats.last_update_time'] = get_datetime()
 




More information about the bind10-changes mailing list