(
nursery: Nursery, running_nodes: List[RunningNode], config: StressTestConfiguration
)
| 537 | |
| 538 | |
| 539 | def run_stress_test( |
| 540 | nursery: Nursery, running_nodes: List[RunningNode], config: StressTestConfiguration |
| 541 | ) -> None: |
| 542 | identifier_generator = count(start=FIRST_VALID_PAYMENT_ID) |
| 543 | profiler_processes: List[Popen] = [] |
| 544 | |
| 545 | # TODO: Add tests with fees. This may require changes to the transfer plan, |
| 546 | # since ATM it depends only in the `capacity_lower_bound` settings. |
| 547 | for iteration in config.iteration_counter: |
| 548 | log.info(f"Starting iteration {iteration}") |
| 549 | |
| 550 | # The configuration has to be re-created on every iteration because the |
| 551 | # port numbers change |
| 552 | plan = StressTestPlan( |
| 553 | transfers=paths_for_mediated_transfers(running_nodes), |
| 554 | concurrency=[50], |
| 555 | planners=[do_fifty_transfer_up_to], |
| 556 | schedulers=[scheduler_preserve_order], |
| 557 | ) |
| 558 | |
| 559 | # TODO: Before running the first plan each node should be queried for |
| 560 | # their channel status. The script should assert the open channels have |
| 561 | # at least `capacity_lower_bound` together. |
| 562 | for concurent_paths, concurrency, transfer_planner, scheduler in zip( |
| 563 | repeat(plan.transfers), plan.concurrency, plan.planners, plan.schedulers |
| 564 | ): |
| 565 | log.info( |
| 566 | f"Starting run {concurent_paths}, {concurrency}, {transfer_planner}, {scheduler}" |
| 567 | ) |
| 568 | |
| 569 | # The plan MUST be executed successfully until exhaustion, |
| 570 | # otherwise the next plan may try to use an amount that is not |
| 571 | # available. |
| 572 | transfer_plan = transfer_planner(config.capacity_lower_bound) |
| 573 | transfers = list(scheduler(concurent_paths, transfer_plan)) |
| 574 | |
| 575 | if config.profiler_data_directory: |
| 576 | profiler_processes = run_profiler( |
| 577 | nursery, running_nodes, config.profiler_data_directory |
| 578 | ) |
| 579 | |
| 580 | wait_for_reachable(plan.transfers, config.token_address, config.retry_timeout) |
| 581 | |
| 582 | # TODO: `do_transfers` should return the amount of tokens |
| 583 | # transferred with each `(from, to)` pair, and the total amount |
| 584 | # must be lower than the `capacity_lower_bound`. |
| 585 | do_transfers( |
| 586 | transfers=transfers, |
| 587 | token_address=config.token_address, |
| 588 | identifier_generator=identifier_generator, |
| 589 | pool_size=concurrency, |
| 590 | ) |
| 591 | |
| 592 | wait_for_balance(running_nodes) |
| 593 | |
| 594 | # After each `do_transfers` the state of the system must be |
| 595 | # reset, otherwise there is a bug in the planner or Raiden. |
| 596 | restarted_nodes = restart_network( |
nothing calls this directly
no test coverage detected