Changeset f12b78e in trunk
- Timestamp:
- 2023-03-21T13:43:45Z (2 years ago)
- Branches:
- master
- Children:
- 559e2ec, a8832b1, d96a22e
- Parents:
- 2dfabf79 (diff), 23b977a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Itamar Turner-Trauring <itamar@…> (2023-03-21 13:43:45)
- git-committer:
- GitHub <noreply@…> (2023-03-21 13:43:45)
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified integration/conftest.py ¶
r2dfabf79 rf12b78e 394 394 ) 395 395 ) 396 await_client_ready(process)396 pytest_twisted.blockon(await_client_ready(process)) 397 397 398 398 # 1. Create a new RW directory cap: … … 425 425 # 4. Restart the node with new SFTP config. 426 426 pytest_twisted.blockon(process.restart_async(reactor, request)) 427 await_client_ready(process)427 pytest_twisted.blockon(await_client_ready(process)) 428 428 print(f"Alice pid: {process.transport.pid}") 429 429 return process … … 440 440 ) 441 441 ) 442 await_client_ready(process)442 pytest_twisted.blockon(await_client_ready(process)) 443 443 return process 444 444 -
TabularUnified integration/test_get_put.py ¶
r2dfabf79 rf12b78e 5 5 6 6 from subprocess import Popen, PIPE, check_output, check_call 7 import sys8 7 9 8 import pytest … … 51 50 52 51 52 @run_in_thread 53 53 def test_get_to_stdout(alice, get_put_alias, tmpdir): 54 54 """ … … 68 68 69 69 70 @run_in_thread 70 71 def test_large_file(alice, get_put_alias, tmp_path): 71 72 """ … … 86 87 87 88 88 @pytest.mark.skipif(89 sys.platform.startswith("win"),90 reason="reconfigure() has issues on Windows"91 )92 89 @ensureDeferred 93 90 async def test_upload_download_immutable_different_default_max_segment_size(alice, get_put_alias, tmpdir, request): -
TabularUnified integration/test_servers_of_happiness.py ¶
r2dfabf79 rf12b78e 32 32 total=10, 33 33 ) 34 util.await_client_ready(edna)34 yield util.await_client_ready(edna) 35 35 36 36 node_dir = join(temp_dir, 'edna') -
TabularUnified integration/test_tor.py ¶
r2dfabf79 rf12b78e 43 43 carol = yield _create_anonymous_node(reactor, 'carol', 8008, request, temp_dir, flog_gatherer, tor_network, tor_introducer_furl) 44 44 dave = yield _create_anonymous_node(reactor, 'dave', 8009, request, temp_dir, flog_gatherer, tor_network, tor_introducer_furl) 45 util.await_client_ready(carol, minimum_number_of_servers=2)46 util.await_client_ready(dave, minimum_number_of_servers=2)45 yield util.await_client_ready(carol, minimum_number_of_servers=2) 46 yield util.await_client_ready(dave, minimum_number_of_servers=2) 47 47 48 48 # ensure both nodes are connected to "a grid" by uploading -
TabularUnified integration/test_web.py ¶
r2dfabf79 rf12b78e 19 19 20 20 from . import util 21 from .util import run_in_thread 21 22 22 23 import requests … … 26 27 from pytest_twisted import ensureDeferred 27 28 29 @run_in_thread 28 30 def test_index(alice): 29 31 """ … … 33 35 34 36 37 @run_in_thread 35 38 def test_index_json(alice): 36 39 """ … … 42 45 43 46 47 @run_in_thread 44 48 def test_upload_download(alice): 45 49 """ … … 71 75 72 76 77 @run_in_thread 73 78 def test_put(alice): 74 79 """ … … 90 95 91 96 97 @run_in_thread 92 98 def test_helper_status(storage_nodes): 93 99 """ … … 102 108 103 109 110 @run_in_thread 104 111 def test_deep_stats(alice): 105 112 """ … … 418 425 419 426 427 @run_in_thread 420 428 def test_storage_info(storage_nodes): 421 429 """ … … 429 437 430 438 439 @run_in_thread 431 440 def test_storage_info_json(storage_nodes): 432 441 """ … … 443 452 444 453 454 @run_in_thread 445 455 def test_introducer_info(introducer): 446 456 """ … … 461 471 462 472 473 @run_in_thread 463 474 def test_mkdir_with_children(alice): 464 475 """ -
TabularUnified integration/util.py ¶
r2dfabf79 rf12b78e 431 431 432 432 433 def run_in_thread(f): 434 """Decorator for integration tests that runs code in a thread. 435 436 Because we're using pytest_twisted, tests that rely on the reactor are 437 expected to return a Deferred and use async APIs so the reactor can run. 438 439 In the case of the integration test suite, it launches nodes in the 440 background using Twisted APIs. The nodes stdout and stderr is read via 441 Twisted code. If the reactor doesn't run, reads don't happen, and 442 eventually the buffers fill up, and the nodes block when they try to flush 443 logs. 444 445 We can switch to Twisted APIs (treq instead of requests etc.), but 446 sometimes it's easier or expedient to just have a blocking test. So this 447 decorator allows you to run the test in a thread, and the reactor can keep 448 running in the main thread. 449 450 See https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3597 for tracking bug. 451 """ 452 @wraps(f) 453 def test(*args, **kwargs): 454 return deferToThread(lambda: f(*args, **kwargs)) 455 return test 456 457 433 458 def await_file_contents(path, contents, timeout=15, error_if=None): 434 459 """ … … 556 581 557 582 583 @run_in_thread 558 584 def await_client_ready(tahoe, timeout=10, liveness=60*2, minimum_number_of_servers=1): 559 585 """ … … 623 649 624 650 625 def run_in_thread(f):626 """Decorator for integration tests that runs code in a thread.627 628 Because we're using pytest_twisted, tests that rely on the reactor are629 expected to return a Deferred and use async APIs so the reactor can run.630 631 In the case of the integration test suite, it launches nodes in the632 background using Twisted APIs. The nodes stdout and stderr is read via633 Twisted code. If the reactor doesn't run, reads don't happen, and634 eventually the buffers fill up, and the nodes block when they try to flush635 logs.636 637 We can switch to Twisted APIs (treq instead of requests etc.), but638 sometimes it's easier or expedient to just have a blocking test. So this639 decorator allows you to run the test in a thread, and the reactor can keep640 running in the main thread.641 642 See https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3597 for tracking bug.643 """644 @wraps(f)645 def test(*args, **kwargs):646 return deferToThread(lambda: f(*args, **kwargs))647 return test648 649 651 @frozen 650 652 class CHK: … … 793 795 794 796 if changed: 795 # TODO reconfigure() seems to have issues on Windows. If you need to796 # use it there, delete this assert and try to figure out what's going797 # on...798 assert not sys.platform.startswith("win")799 800 797 # restart the node 801 798 print(f"Restarting {node.node_dir} for ZFEC reconfiguration") 802 799 await node.restart_async(reactor, request) 803 800 print("Restarted. Waiting for ready state.") 804 await _client_ready(node)801 await await_client_ready(node) 805 802 print("Ready.") 806 803 else:
Note: See TracChangeset
for help on using the changeset viewer.