2 from twisted.trial import unittest
4 from twisted.python import usage, runtime
5 from twisted.internet import utils
6 import os.path, re, sys
7 from cStringIO import StringIO
8 from allmydata.util import fileutil, pollmixin
9 from allmydata.scripts import runner
11 from allmydata.test import common_util
14 bintahoe = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(allmydata.__file__))), 'bin', 'tahoe')
15 if sys.platform == "win32":
18 class TheRightCode(unittest.TestCase, common_util.SignalMixin):
20 if not os.path.exists(bintahoe):
21 raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
22 d = utils.getProcessOutputAndValue(bintahoe, args=["--version-and-path"], env=os.environ)
24 out, err, rc_or_sig = res
25 self.failUnlessEqual(rc_or_sig, 0)
27 # Fail unless the allmydata-tahoe package is *this* version *and* was loaded from *this* source directory.
28 required_ver_and_path = "allmydata-tahoe: %s (%s)" % (allmydata.__version__, os.path.dirname(os.path.dirname(allmydata.__file__)))
29 self.failUnless(out.startswith(required_ver_and_path), (out, err, rc_or_sig, required_ver_and_path))
33 class CreateNode(unittest.TestCase):
34 # exercise "tahoe create-client", create-introducer,
35 # create-key-generator, and create-stats-gatherer, by calling the
36 # corresponding code as a subroutine.
38 def workdir(self, name):
39 basedir = os.path.join("test_runner", "CreateNode", name)
40 fileutil.make_dirs(basedir)
43 def run_tahoe(self, argv):
44 out,err = StringIO(), StringIO()
45 rc = runner.runner(argv, stdout=out, stderr=err)
46 return rc, out.getvalue(), err.getvalue()
48 def test_client(self):
49 basedir = self.workdir("test_client")
50 c1 = os.path.join(basedir, "c1")
51 argv = ["--quiet", "create-client", "--basedir", c1]
52 rc, out, err = self.run_tahoe(argv)
53 self.failUnlessEqual(err, "")
54 self.failUnlessEqual(out, "")
55 self.failUnlessEqual(rc, 0)
56 self.failUnless(os.path.exists(c1))
57 self.failUnless(os.path.exists(os.path.join(c1, "tahoe-client.tac")))
59 # creating the client a second time should be rejected
60 rc, out, err = self.run_tahoe(argv)
61 self.failIfEqual(rc, 0, str((out, err, rc)))
62 self.failUnlessEqual(out, "")
63 self.failUnless("is not empty." in err)
65 # Fail if there is a non-empty line that doesn't end with a
67 for line in err.splitlines():
68 self.failIf(re.search("[\S][^\.!?]$", line), (line,))
70 # test that the non --basedir form works too
71 c2 = os.path.join(basedir, "c2")
72 argv = ["--quiet", "create-client", c2]
73 rc, out, err = self.run_tahoe(argv)
74 self.failUnless(os.path.exists(c2))
75 self.failUnless(os.path.exists(os.path.join(c2, "tahoe-client.tac")))
77 # make sure it rejects too many arguments
78 argv = ["create-client", "basedir", "extraarg"]
79 self.failUnlessRaises(usage.UsageError,
83 def test_introducer(self):
84 basedir = self.workdir("test_introducer")
85 c1 = os.path.join(basedir, "c1")
86 argv = ["--quiet", "create-introducer", "--basedir", c1]
87 rc, out, err = self.run_tahoe(argv)
88 self.failUnlessEqual(err, "", err)
89 self.failUnlessEqual(out, "")
90 self.failUnlessEqual(rc, 0)
91 self.failUnless(os.path.exists(c1))
92 self.failUnless(os.path.exists(os.path.join(c1,"tahoe-introducer.tac")))
94 # creating the introducer a second time should be rejected
95 rc, out, err = self.run_tahoe(argv)
96 self.failIfEqual(rc, 0)
97 self.failUnlessEqual(out, "")
98 self.failUnless("is not empty" in err)
100 # Fail if there is a non-empty line that doesn't end with a
102 for line in err.splitlines():
103 self.failIf(re.search("[\S][^\.!?]$", line), (line,))
105 # test the non --basedir form
106 c2 = os.path.join(basedir, "c2")
107 argv = ["--quiet", "create-introducer", c2]
108 rc, out, err = self.run_tahoe(argv)
109 self.failUnlessEqual(err, "", err)
110 self.failUnlessEqual(out, "")
111 self.failUnlessEqual(rc, 0)
112 self.failUnless(os.path.exists(c2))
113 self.failUnless(os.path.exists(os.path.join(c2,"tahoe-introducer.tac")))
115 # reject extra arguments
116 argv = ["create-introducer", "basedir", "extraarg"]
117 self.failUnlessRaises(usage.UsageError,
120 # and require basedir to be provided in some form
121 argv = ["create-introducer"]
122 self.failUnlessRaises(usage.UsageError,
126 def test_key_generator(self):
127 basedir = self.workdir("test_key_generator")
128 kg1 = os.path.join(basedir, "kg1")
129 argv = ["--quiet", "create-key-generator", "--basedir", kg1]
130 rc, out, err = self.run_tahoe(argv)
131 self.failUnlessEqual(err, "")
132 self.failUnlessEqual(out, "")
133 self.failUnlessEqual(rc, 0)
134 self.failUnless(os.path.exists(kg1))
135 self.failUnless(os.path.exists(os.path.join(kg1, "tahoe-key-generator.tac")))
137 # creating it a second time should be rejected
138 rc, out, err = self.run_tahoe(argv)
139 self.failIfEqual(rc, 0, str((out, err, rc)))
140 self.failUnlessEqual(out, "")
141 self.failUnless("is not empty." in err)
143 # make sure it rejects too many arguments
144 argv = ["create-key-generator", "basedir", "extraarg"]
145 self.failUnlessRaises(usage.UsageError,
149 # make sure it rejects a missing basedir specification
150 argv = ["create-key-generator"]
151 rc, out, err = self.run_tahoe(argv)
152 self.failIfEqual(rc, 0, str((out, err, rc)))
153 self.failUnlessEqual(out, "")
154 self.failUnless("a basedir was not provided" in err)
156 def test_stats_gatherer(self):
157 basedir = self.workdir("test_stats_gatherer")
158 sg1 = os.path.join(basedir, "sg1")
159 argv = ["--quiet", "create-stats-gatherer", "--basedir", sg1]
160 rc, out, err = self.run_tahoe(argv)
161 self.failUnlessEqual(err, "")
162 self.failUnlessEqual(out, "")
163 self.failUnlessEqual(rc, 0)
164 self.failUnless(os.path.exists(sg1))
165 self.failUnless(os.path.exists(os.path.join(sg1, "tahoe-stats-gatherer.tac")))
167 # creating it a second time should be rejected
168 rc, out, err = self.run_tahoe(argv)
169 self.failIfEqual(rc, 0, str((out, err, rc)))
170 self.failUnlessEqual(out, "")
171 self.failUnless("is not empty." in err)
173 # test the non --basedir form
174 kg2 = os.path.join(basedir, "kg2")
175 argv = ["--quiet", "create-stats-gatherer", kg2]
176 rc, out, err = self.run_tahoe(argv)
177 self.failUnlessEqual(err, "", err)
178 self.failUnlessEqual(out, "")
179 self.failUnlessEqual(rc, 0)
180 self.failUnless(os.path.exists(kg2))
181 self.failUnless(os.path.exists(os.path.join(kg2,"tahoe-stats-gatherer.tac")))
183 # make sure it rejects too many arguments
184 argv = ["create-stats-gatherer", "basedir", "extraarg"]
185 self.failUnlessRaises(usage.UsageError,
189 # make sure it rejects a missing basedir specification
190 argv = ["create-stats-gatherer"]
191 rc, out, err = self.run_tahoe(argv)
192 self.failIfEqual(rc, 0, str((out, err, rc)))
193 self.failUnlessEqual(out, "")
194 self.failUnless("a basedir was not provided" in err)
196 def test_subcommands(self):
197 # no arguments should trigger a command listing, via UsageError
198 self.failUnlessRaises(usage.UsageError,
204 class RunNode(unittest.TestCase, pollmixin.PollMixin, common_util.SignalMixin):
205 def workdir(self, name):
206 basedir = os.path.join("test_runner", "RunNode", name)
207 fileutil.make_dirs(basedir)
210 def test_introducer(self):
211 if not os.path.exists(bintahoe):
212 raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
213 if runtime.platformType == "win32":
214 # twistd on windows doesn't daemonize. cygwin works normally.
215 raise unittest.SkipTest("twistd does not fork under windows")
216 basedir = self.workdir("test_introducer")
217 c1 = os.path.join(basedir, "c1")
218 HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline")
219 TWISTD_PID_FILE = os.path.join(c1, "twistd.pid")
220 INTRODUCER_FURL_FILE = os.path.join(c1, "introducer.furl")
222 d = utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "create-introducer", "--basedir", c1], env=os.environ)
224 out, err, rc_or_sig = res
225 self.failUnlessEqual(rc_or_sig, 0)
226 # by writing this file, we get ten seconds before the node will
227 # exit. This insures that even if the test fails (and the 'stop'
228 # command doesn't work), the client should still terminate.
229 open(HOTLINE_FILE, "w").write("")
230 # now it's safe to start the node
233 def _then_start_the_node(res):
234 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", c1], env=os.environ)
235 d.addCallback(_then_start_the_node)
238 out, err, rc_or_sig = res
240 open(HOTLINE_FILE, "w").write("")
241 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
242 self.failUnlessEqual(rc_or_sig, 0, errstr)
243 self.failUnlessEqual(out, "", errstr)
244 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
246 # the parent (twistd) has exited. However, twistd writes the pid
247 # from the child, not the parent, so we can't expect twistd.pid
248 # to exist quite yet.
250 # the node is running, but it might not have made it past the
251 # first reactor turn yet, and if we kill it too early, it won't
252 # remove the twistd.pid file. So wait until it does something
253 # that we know it won't do until after the first turn.
256 def _node_has_started():
257 return os.path.exists(INTRODUCER_FURL_FILE)
258 d.addCallback(lambda res: self.poll(_node_has_started))
261 open(HOTLINE_FILE, "w").write("")
262 self.failUnless(os.path.exists(TWISTD_PID_FILE))
263 # rm this so we can detect when the second incarnation is ready
264 os.unlink(INTRODUCER_FURL_FILE)
265 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "restart", c1], env=os.environ)
266 d.addCallback(_started)
269 out, err, rc_or_sig = res
270 open(HOTLINE_FILE, "w").write("")
271 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
272 self.failUnlessEqual(rc_or_sig, 0, errstr)
273 self.failUnlessEqual(out, "", errstr)
274 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
277 # again, the second incarnation of the node might not be ready yet,
278 # so poll until it is
279 d.addCallback(lambda res: self.poll(_node_has_started))
281 # now we can kill it. TODO: On a slow machine, the node might kill
282 # itself before we get a chance too, especially if spawning the
283 # 'tahoe stop' command takes a while.
285 open(HOTLINE_FILE, "w").write("")
286 self.failUnless(os.path.exists(TWISTD_PID_FILE))
288 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "stop", c1], env=os.environ)
291 def _after_stopping(res):
292 out, err, rc_or_sig = res
293 open(HOTLINE_FILE, "w").write("")
294 # the parent has exited by now
295 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
296 self.failUnlessEqual(rc_or_sig, 0, errstr)
297 self.failUnlessEqual(out, "", errstr)
298 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
299 # the parent was supposed to poll and wait until it sees
300 # twistd.pid go away before it exits, so twistd.pid should be
302 self.failIf(os.path.exists(TWISTD_PID_FILE))
303 d.addCallback(_after_stopping)
305 def _remove_hotline(res):
306 os.unlink(HOTLINE_FILE)
308 d.addBoth(_remove_hotline)
311 def test_client_no_noise(self):
312 if not os.path.exists(bintahoe):
313 raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
314 basedir = self.workdir("test_client_no_noise")
315 c1 = os.path.join(basedir, "c1")
316 HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline")
317 TWISTD_PID_FILE = os.path.join(c1, "twistd.pid")
318 PORTNUMFILE = os.path.join(c1, "client.port")
320 d = utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "create-client", "--basedir", c1, "--webport", "0"], env=os.environ)
322 out, err, rc_or_sig = res
323 errstr = "cc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
324 assert rc_or_sig == 0, errstr
325 self.failUnlessEqual(rc_or_sig, 0)
326 # By writing this file, we get forty seconds before the client will exit. This insures
327 # that even if the 'stop' command doesn't work (and the test fails), the client should
329 open(HOTLINE_FILE, "w").write("")
330 open(os.path.join(c1, "introducer.furl"), "w").write("pb://xrndsskn2zuuian5ltnxrte7lnuqdrkz@127.0.0.1:55617/introducer\n")
331 # now it's safe to start the node
335 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", c1], env=os.environ)
336 d.addCallback(_start)
339 out, err, rc_or_sig = res
340 errstr = "cc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
341 open(HOTLINE_FILE, "w").write("")
342 self.failUnlessEqual(rc_or_sig, 0, errstr)
343 self.failUnlessEqual(out, "", errstr) # If you emit noise, you fail this test.
344 self.failUnlessEqual(err, "", errstr)
346 # the parent (twistd) has exited. However, twistd writes the pid
347 # from the child, not the parent, so we can't expect twistd.pid
348 # to exist quite yet.
350 # the node is running, but it might not have made it past the
351 # first reactor turn yet, and if we kill it too early, it won't
352 # remove the twistd.pid file. So wait until it does something
353 # that we know it won't do until after the first turn.
356 def _node_has_started():
357 return os.path.exists(PORTNUMFILE)
358 d.addCallback(lambda res: self.poll(_node_has_started))
360 # now we can kill it. TODO: On a slow machine, the node might kill
361 # itself before we get a chance too, especially if spawning the
362 # 'tahoe stop' command takes a while.
364 self.failUnless(os.path.exists(TWISTD_PID_FILE), (TWISTD_PID_FILE, os.listdir(os.path.dirname(TWISTD_PID_FILE))))
365 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "stop", c1], env=os.environ)
368 test_client_no_noise.todo = "We submitted a patch to Nevow to silence this warning: http://divmod.org/trac/ticket/2830"
370 def test_client(self):
371 if not os.path.exists(bintahoe):
372 raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
373 if runtime.platformType == "win32":
374 # twistd on windows doesn't daemonize. cygwin works normally.
375 raise unittest.SkipTest("twistd does not fork under windows")
376 basedir = self.workdir("test_client")
377 c1 = os.path.join(basedir, "c1")
378 HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline")
379 TWISTD_PID_FILE = os.path.join(c1, "twistd.pid")
380 PORTNUMFILE = os.path.join(c1, "client.port")
382 d = utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "create-client", "--basedir", c1, "--webport", "0"], env=os.environ)
384 out, err, rc_or_sig = res
385 self.failUnlessEqual(rc_or_sig, 0)
386 # By writing this file, we get forty seconds before the client will exit. This insures
387 # that even if the 'stop' command doesn't work (and the test fails), the client should
389 open(HOTLINE_FILE, "w").write("")
390 open(os.path.join(c1, "introducer.furl"), "w").write("pb://xrndsskn2zuuian5ltnxrte7lnuqdrkz@127.0.0.1:55617/introducer\n")
391 # now it's safe to start the node
395 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", c1], env=os.environ)
396 d.addCallback(_start)
399 out, err, rc_or_sig = res
400 open(HOTLINE_FILE, "w").write("")
401 errstr = "cc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
402 self.failUnlessEqual(rc_or_sig, 0, errstr)
403 self.failUnlessEqual(out, "", errstr)
404 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
406 # the parent (twistd) has exited. However, twistd writes the pid
407 # from the child, not the parent, so we can't expect twistd.pid
408 # to exist quite yet.
410 # the node is running, but it might not have made it past the
411 # first reactor turn yet, and if we kill it too early, it won't
412 # remove the twistd.pid file. So wait until it does something
413 # that we know it won't do until after the first turn.
416 def _node_has_started():
417 return os.path.exists(PORTNUMFILE)
418 d.addCallback(lambda res: self.poll(_node_has_started))
421 open(HOTLINE_FILE, "w").write("")
422 self.failUnless(os.path.exists(TWISTD_PID_FILE))
423 # rm this so we can detect when the second incarnation is ready
424 os.unlink(PORTNUMFILE)
426 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "restart", c1], env=os.environ)
427 d.addCallback(_started)
430 out, err, rc_or_sig = res
432 open(HOTLINE_FILE, "w").write("")
433 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
434 self.failUnlessEqual(rc_or_sig, 0, errstr)
435 self.failUnlessEqual(out, "", errstr)
436 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
439 # again, the second incarnation of the node might not be ready yet,
440 # so poll until it is
441 d.addCallback(lambda res: self.poll(_node_has_started))
443 # now we can kill it. TODO: On a slow machine, the node might kill
444 # itself before we get a chance too, especially if spawning the
445 # 'tahoe stop' command takes a while.
447 open(HOTLINE_FILE, "w").write("")
448 self.failUnless(os.path.exists(TWISTD_PID_FILE), (TWISTD_PID_FILE, os.listdir(os.path.dirname(TWISTD_PID_FILE))))
449 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "stop", c1], env=os.environ)
453 out, err, rc_or_sig = res
455 open(HOTLINE_FILE, "w").write("")
456 # the parent has exited by now
457 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
458 self.failUnlessEqual(rc_or_sig, 0, errstr)
459 self.failUnlessEqual(out, "", errstr)
460 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
461 # the parent was supposed to poll and wait until it sees
462 # twistd.pid go away before it exits, so twistd.pid should be
464 self.failIf(os.path.exists(TWISTD_PID_FILE))
466 def _remove_hotline(res):
467 os.unlink(HOTLINE_FILE)
469 d.addBoth(_remove_hotline)
472 def test_baddir(self):
473 if not os.path.exists(bintahoe):
474 raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
475 basedir = self.workdir("test_baddir")
476 fileutil.make_dirs(basedir)
478 d = utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", "--basedir", basedir], env=os.environ)
480 out, err, rc_or_sig = res
481 self.failUnlessEqual(rc_or_sig, 1)
482 self.failUnless("does not look like a node directory" in err)
485 def _then_stop_it(res):
486 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "stop", "--basedir", basedir], env=os.environ)
487 d.addCallback(_then_stop_it)
490 out, err, rc_or_sig = res
491 self.failUnlessEqual(rc_or_sig, 2)
492 self.failUnless("does not look like a running node directory" in err)
495 def _then_start_in_bogus_basedir(res):
496 not_a_dir = os.path.join(basedir, "bogus")
497 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", "--basedir", not_a_dir], env=os.environ)
498 d.addCallback(_then_start_in_bogus_basedir)
501 out, err, rc_or_sig = res
502 self.failUnlessEqual(rc_or_sig, 1)
503 self.failUnless("does not look like a directory at all" in err, err)
507 def test_keygen(self):
508 if not os.path.exists(bintahoe):
509 raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
510 if runtime.platformType == "win32":
511 # twistd on windows doesn't daemonize. cygwin works normally.
512 raise unittest.SkipTest("twistd does not fork under windows")
513 basedir = self.workdir("test_keygen")
514 c1 = os.path.join(basedir, "c1")
515 TWISTD_PID_FILE = os.path.join(c1, "twistd.pid")
516 KEYGEN_FURL_FILE = os.path.join(c1, "key_generator.furl")
518 d = utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "create-key-generator", "--basedir", c1], env=os.environ)
520 out, err, rc_or_sig = res
521 self.failUnlessEqual(rc_or_sig, 0)
525 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", c1], env=os.environ)
526 d.addCallback(_start)
529 out, err, rc_or_sig = res
530 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
531 self.failUnlessEqual(rc_or_sig, 0, errstr)
532 self.failUnlessEqual(out, "", errstr)
533 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
535 # the parent (twistd) has exited. However, twistd writes the pid
536 # from the child, not the parent, so we can't expect twistd.pid
537 # to exist quite yet.
539 # the node is running, but it might not have made it past the
540 # first reactor turn yet, and if we kill it too early, it won't
541 # remove the twistd.pid file. So wait until it does something
542 # that we know it won't do until after the first turn.
545 def _node_has_started():
546 return os.path.exists(KEYGEN_FURL_FILE)
547 d.addCallback(lambda res: self.poll(_node_has_started))
550 self.failUnless(os.path.exists(TWISTD_PID_FILE))
551 # rm this so we can detect when the second incarnation is ready
552 os.unlink(KEYGEN_FURL_FILE)
553 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "restart", c1], env=os.environ)
554 d.addCallback(_started)
557 out, err, rc_or_sig = res
558 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
559 self.failUnlessEqual(rc_or_sig, 0, errstr)
560 self.failUnlessEqual(out, "", errstr)
561 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
564 # again, the second incarnation of the node might not be ready yet,
565 # so poll until it is
566 d.addCallback(lambda res: self.poll(_node_has_started))
568 # now we can kill it. TODO: On a slow machine, the node might kill
569 # itself before we get a chance too, especially if spawning the
570 # 'tahoe stop' command takes a while.
572 self.failUnless(os.path.exists(TWISTD_PID_FILE))
573 return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "stop", c1], env=os.environ)
577 out, err, rc_or_sig = res
578 # the parent has exited by now
579 errstr = "rc=%d, OUT: '%s', ERR: '%s'" % (rc_or_sig, out, err)
580 self.failUnlessEqual(rc_or_sig, 0, errstr)
581 self.failUnlessEqual(out, "", errstr)
582 # self.failUnlessEqual(err, "", errstr) # See test_client_no_noise -- for now we ignore noise.
583 # the parent was supposed to poll and wait until it sees
584 # twistd.pid go away before it exits, so twistd.pid should be
586 self.failIf(os.path.exists(TWISTD_PID_FILE))