From 95ab227ed0b12b41560f3229eafc99792634769f Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 2 Jun 2010 18:30:04 +0100
Subject: [PATCH] TestAsyncUDPSocket: remove dead code and add test

- _ThreadedClient was added on the idea of making this unittest
  concurrent, which was actually never done (we could test everything
  without it, so well)
- handle_write() was never called without filling the send queue, and
  this caused me trouble now that I learned to look at coverage

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 test/ganeti.daemon_unittest.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/test/ganeti.daemon_unittest.py b/test/ganeti.daemon_unittest.py
index 74ef1cdf2..b064027a4 100755
--- a/test/ganeti.daemon_unittest.py
+++ b/test/ganeti.daemon_unittest.py
@@ -186,12 +186,6 @@ class TestAsyncUDPSocket(testutils.GanetiTestCase):
   def testNoDoubleBind(self):
     self.assertRaises(socket.error, self.client.bind, ("127.0.0.1", self.port))
 
-  def _ThreadedClient(self, payload):
-    self.client.enqueue_send("127.0.0.1", self.port, payload)
-    print "sending %s" % payload
-    while self.client.writable():
-      self.client.handle_write()
-
   def testAsyncClientServer(self):
     self.client.enqueue_send("127.0.0.1", self.port, "p1")
     self.client.enqueue_send("127.0.0.1", self.port, "p2")
@@ -200,6 +194,7 @@ class TestAsyncUDPSocket(testutils.GanetiTestCase):
     self.assertEquals(self.server.received, ["p1", "p2", "terminate"])
 
   def testSyncClientServer(self):
+    self.client.handle_write()
     self.client.enqueue_send("127.0.0.1", self.port, "p1")
     self.client.enqueue_send("127.0.0.1", self.port, "p2")
     while self.client.writable():
-- 
GitLab