mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 10:46:24 +00:00
improving system test, still broken, possibly a Foolscap problem
This commit is contained in:
parent
40f7fe3fe7
commit
eee7d0d814
@ -2,9 +2,10 @@
|
|||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
from allmydata import upload, client, queen
|
from allmydata import client, queen
|
||||||
import os
|
import os
|
||||||
from foolscap.eventual import flushEventualQueue
|
from foolscap.eventual import flushEventualQueue
|
||||||
|
from twisted.python import log
|
||||||
|
|
||||||
class SystemTest(unittest.TestCase):
|
class SystemTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -19,15 +20,19 @@ class SystemTest(unittest.TestCase):
|
|||||||
s.setServiceParent(self.sparent)
|
s.setServiceParent(self.sparent)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def setUpNodes(self):
|
def setUpNodes(self, NUMCLIENTS=5):
|
||||||
os.mkdir("queen")
|
if not os.path.isdir("queen"):
|
||||||
q = self.addService(queen.Queen(basedir="queen"))
|
os.mkdir("queen")
|
||||||
clients = []
|
q = self.queen = self.addService(queen.Queen(basedir="queen"))
|
||||||
NUMCLIENTS = 5
|
queen_pburl = q.urls["roster"]
|
||||||
|
clients = self.clients = []
|
||||||
|
|
||||||
for i in range(NUMCLIENTS):
|
for i in range(NUMCLIENTS):
|
||||||
basedir = "client%d" % i
|
basedir = "client%d" % i
|
||||||
os.mkdir(basedir)
|
if not os.path.isdir(basedir):
|
||||||
|
os.mkdir(basedir)
|
||||||
c = self.addService(client.Client(basedir=basedir))
|
c = self.addService(client.Client(basedir=basedir))
|
||||||
|
c.set_queen_pburl(queen_pburl)
|
||||||
clients.append(c)
|
clients.append(c)
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +42,23 @@ class SystemTest(unittest.TestCase):
|
|||||||
reactor.callLater(1, d.callback, None)
|
reactor.callLater(1, d.callback, None)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def test_it(self):
|
def test_connections(self):
|
||||||
self.setUpNodes()
|
self.setUpNodes()
|
||||||
d = self.waitForConnections()
|
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
|
return d
|
||||||
|
Loading…
Reference in New Issue
Block a user