]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
improving system test, still broken, possibly a Foolscap problem
authorBrian Warner <warner@lothar.com>
Sun, 3 Dec 2006 03:32:08 +0000 (20:32 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 3 Dec 2006 03:32:08 +0000 (20:32 -0700)
allmydata/test/test_system.py

index 060ed5a7aba5ec16f3d10408e2af4f63a2b56bcd..7b7ad7b93908559064742dffe562e049ac81dd7c 100644 (file)
@@ -2,9 +2,10 @@
 from twisted.trial import unittest
 from twisted.internet import defer, reactor
 from twisted.application import service
-from allmydata import upload, client, queen
+from allmydata import client, queen
 import os
 from foolscap.eventual import flushEventualQueue
+from twisted.python import log
 
 class SystemTest(unittest.TestCase):
     def setUp(self):
@@ -19,15 +20,19 @@ class SystemTest(unittest.TestCase):
         s.setServiceParent(self.sparent)
         return s
 
-    def setUpNodes(self):
-        os.mkdir("queen")
-        q = self.addService(queen.Queen(basedir="queen"))
-        clients = []
-        NUMCLIENTS = 5
+    def setUpNodes(self, NUMCLIENTS=5):
+        if not os.path.isdir("queen"):
+            os.mkdir("queen")
+        q = self.queen = self.addService(queen.Queen(basedir="queen"))
+        queen_pburl = q.urls["roster"]
+        clients = self.clients = []
+
         for i in range(NUMCLIENTS):
             basedir = "client%d" % i
-            os.mkdir(basedir)
+            if not os.path.isdir(basedir):
+                os.mkdir(basedir)
             c = self.addService(client.Client(basedir=basedir))
+            c.set_queen_pburl(queen_pburl)
             clients.append(c)
 
 
@@ -37,7 +42,23 @@ class SystemTest(unittest.TestCase):
         reactor.callLater(1, d.callback, None)
         return d
 
-    def test_it(self):
+    def test_connections(self):
+        self.setUpNodes()
+        d = self.waitForConnections()
+        def _check(res):
+            log.msg("CHECKING")
+            for c in self.clients:
+                self.failUnlessEqual(len(c.connections), 4)
+        d.addCallback(_check)
+        return d
+
+    def test_upload(self):
         self.setUpNodes()
         d = self.waitForConnections()
+        def _upload(res):
+            log.msg("DONE")
+            u = self.clients[0].getServiceNamed("uploader")
+            d1 = u.upload_data("Some data to upload")
+            return d1
+        d.addCallback(_upload)
         return d