Browse Source

[2353] Ensure that the server listens on the socket

Mukund Sivaraman 12 years ago
parent
commit
32e88854b4
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/bin/bind10/tests/bind10_test.py.in

+ 13 - 0
src/bin/bind10/tests/bind10_test.py.in

@@ -387,6 +387,19 @@ class TestBoB(unittest.TestCase):
         self.assertIsNotNone(bob._socket_path)
         self.assertTrue(os.path.exists(bob._socket_path))
 
+        # Check that it's possible to connect to the socket file (this
+        # only works if the socket file exists and the server listens on
+        # it).
+        s = socket.socket(socket.AF_UNIX)
+        try:
+            s.connect(bob._socket_path)
+            can_connect = True
+            s.close()
+        except socket.error as e:
+            can_connect = False
+
+        self.assertTrue(can_connect)
+
         bob.remove_socket_srv()
 
         self.assertEqual(-1, bob._srv_socket.fileno())