BIND 10 trac1429, updated. b092df6f17e5d8f8f07e726fc4006e346417d49f [1429] The socket_consumer_dead method
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Nov 29 13:10:02 UTC 2011
The branch, trac1429 has been updated
via b092df6f17e5d8f8f07e726fc4006e346417d49f (commit)
from d9b851b96c9fb3f56c4fe3a626f5c2b05bbb7a5f (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 b092df6f17e5d8f8f07e726fc4006e346417d49f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Nov 29 14:09:39 2011 +0100
[1429] The socket_consumer_dead method
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10_src.py.in | 2 +-
src/bin/bind10/tests/bind10_test.py.in | 42 ++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 35e852a..a780843 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -828,7 +828,7 @@ class BoB:
sockets sent to it are to be considered closed. This function signals
so to the _socket_cache.
"""
- pass
+ self._socket_cache.drop_application(unix_socket.fileno())
def insert_creator(self, creator):
"""
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index ba72a6a..41b430b 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -98,6 +98,48 @@ class TestProcessInfo(unittest.TestCase):
self.assertTrue(type(pi.pid) is int)
self.assertNotEqual(pi.pid, old_pid)
+class TestCacheCommands(unittest.TestCase):
+ """
+ Test methods of boss related to the socket cache and socket handling.
+ """
+ def setUp(self):
+ """
+ Prepare the boss for some tests.
+
+ Also prepare some variables we need.
+ """
+ self.__boss = BoB()
+ # Fake the cache here so we can pretend it is us and hijack the
+ # calls to its methods.
+ self.__boss._socket_cache = self
+ # What was and wasn't called.
+ self.__drop_app_called = None
+
+ class FalseSocket:
+ """
+ A socket where we can fake methods we need instead of having a real
+ socket.
+ """
+ def fileno(self):
+ """
+ The file number. Used for identifying the remote application.
+ """
+ return 42
+
+ def drop_application(self, application):
+ """
+ Part of pretending to be the cache. Logs the parameter to
+ self.__drop_app_called.
+ """
+ self.__drop_app_called = application
+
+ def test_consumer_dead(self):
+ """
+ Test that it calls the drop_application method of the cache.
+ """
+ self.__boss.socket_consumer_dead(self.FalseSocket())
+ self.assertEqual(42, self.__drop_app_called)
+
class TestBoB(unittest.TestCase):
def test_init(self):
bob = BoB()
More information about the bind10-changes
mailing list