Account for state from other tests

This commit is contained in:
Jean-Paul Calderone 2019-03-18 19:19:57 -04:00
parent b76d23e45a
commit 420000bfdb

View File

@ -411,20 +411,30 @@ def test_alice_adds_files_while_bob_is_offline(reactor, request, temp_dir, magic
yield util.cli(reactor, bob_node_dir, "stop") yield util.cli(reactor, bob_node_dir, "stop")
# Create a couple files in Alice's local directory. # Create a couple files in Alice's local directory.
some_files = ["foo", "bar", "baz"] some_files = list(
(name * 3) + ".added-while-offline"
for name
in "xyz"
)
for name in some_files: for name in some_files:
with open(join(alice_magic_dir, name), "w") as f: with open(join(alice_magic_dir, name), "w") as f:
f.write(name + " some content") f.write(name + " some content")
while True: good = False
for i in range(15):
status = yield util.magic_folder_cli(reactor, alice_node_dir, "status") status = yield util.magic_folder_cli(reactor, alice_node_dir, "status")
if status.count("good, version=0") == len(some_files) * 2: good = status.count(".added-while-offline (36 B): good, version=0") == len(some_files) * 2
if good:
# We saw each file as having a local good state and a remote good # We saw each file as having a local good state and a remote good
# state. That means we're ready to involve Bob. # state. That means we're ready to involve Bob.
break break
else: else:
time.sleep(1.0) time.sleep(1.0)
assert good, (
"Timed out waiting for good Alice state. Last status:\n{}".format(status)
)
# Start Bob up again # Start Bob up again
magic_text = 'Completed initial Magic Folder scan successfully' magic_text = 'Completed initial Magic Folder scan successfully'
yield util._run_node(reactor, bob_node_dir, request, magic_text) yield util._run_node(reactor, bob_node_dir, request, magic_text)