mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-12 16:02:43 +00:00
use UseNode more in test_client.py
Also make write_introducer more lenient about filesystem state
This commit is contained in:
parent
5a71774bf8
commit
5caa80fe38
@ -141,7 +141,9 @@ def write_introducer(basedir, petname, furl):
|
|||||||
"""
|
"""
|
||||||
if isinstance(furl, bytes):
|
if isinstance(furl, bytes):
|
||||||
furl = furl.decode("utf-8")
|
furl = furl.decode("utf-8")
|
||||||
basedir.child(b"private").child(b"introducers.yaml").setContent(
|
private = basedir.child(b"private")
|
||||||
|
private.makedirs(ignoreExistingDirectory=True)
|
||||||
|
private.child(b"introducers.yaml").setContent(
|
||||||
safe_dump({
|
safe_dump({
|
||||||
"introducers": {
|
"introducers": {
|
||||||
petname: {
|
petname: {
|
||||||
|
@ -89,6 +89,7 @@ from .common import (
|
|||||||
UseTestPlugins,
|
UseTestPlugins,
|
||||||
MemoryIntroducerClient,
|
MemoryIntroducerClient,
|
||||||
get_published_announcements,
|
get_published_announcements,
|
||||||
|
UseNode,
|
||||||
)
|
)
|
||||||
from .matchers import (
|
from .matchers import (
|
||||||
MatchesSameElements,
|
MatchesSameElements,
|
||||||
@ -953,13 +954,14 @@ class Run(unittest.TestCase, testutil.StallMixin):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_reloadable(self):
|
def test_reloadable(self):
|
||||||
basedir = FilePath("test_client.Run.test_reloadable")
|
from twisted.internet import reactor
|
||||||
private = basedir.child("private")
|
|
||||||
private.makedirs()
|
|
||||||
dummy = "pb://wl74cyahejagspqgy4x5ukrvfnevlknt@127.0.0.1:58889/bogus"
|
dummy = "pb://wl74cyahejagspqgy4x5ukrvfnevlknt@127.0.0.1:58889/bogus"
|
||||||
write_introducer(basedir, "someintroducer", dummy)
|
fixture = UseNode(None, None, FilePath(self.mktemp()), dummy, reactor=reactor)
|
||||||
basedir.child("tahoe.cfg").setContent(BASECONFIG. encode("ascii"))
|
fixture.setUp()
|
||||||
c1 = yield client.create_client(basedir.path)
|
self.addCleanup(fixture.cleanUp)
|
||||||
|
|
||||||
|
c1 = yield fixture.create_node()
|
||||||
c1.setServiceParent(self.sparent)
|
c1.setServiceParent(self.sparent)
|
||||||
|
|
||||||
# delay to let the service start up completely. I'm not entirely sure
|
# delay to let the service start up completely. I'm not entirely sure
|
||||||
@ -981,7 +983,7 @@ class Run(unittest.TestCase, testutil.StallMixin):
|
|||||||
# also change _check_exit_trigger to use it instead of a raw
|
# also change _check_exit_trigger to use it instead of a raw
|
||||||
# reactor.stop, also instrument the shutdown event in an
|
# reactor.stop, also instrument the shutdown event in an
|
||||||
# attribute that we can check.)
|
# attribute that we can check.)
|
||||||
c2 = yield client.create_client(basedir.path)
|
c2 = yield fixture.create_node()
|
||||||
c2.setServiceParent(self.sparent)
|
c2.setServiceParent(self.sparent)
|
||||||
yield c2.disownServiceParent()
|
yield c2.disownServiceParent()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user