Commit cd087d4
committed
sweepbatcher/test: fix races in require.Eventually
The code inside require.Eventually runs in parallel with the event loops
of the batcher and its batches. Accessing fields of the batcher and batches
must be done within an event loop.
To address this, testRunInEventLoop methods were added to the Batcher and batch
types. Unit tests were then rewritten to use this approach when accessing
batcher and batch fields.
Additionally, in many cases, receive operations from RegisterSpendChannel
were moved before require.Eventually. This prevents testRunInEventLoop from
getting stuck in an event loop while blocked on a RegisterSpendChannel send
operation.1 parent 34d70f9 commit cd087d4
File tree
3 files changed
+485
-228
lines changed- sweepbatcher
3 files changed
+485
-228
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
218 | 224 | | |
219 | 225 | | |
220 | 226 | | |
| |||
352 | 358 | | |
353 | 359 | | |
354 | 360 | | |
| 361 | + | |
355 | 362 | | |
356 | 363 | | |
357 | 364 | | |
| |||
396 | 403 | | |
397 | 404 | | |
398 | 405 | | |
| 406 | + | |
399 | 407 | | |
400 | 408 | | |
401 | 409 | | |
| |||
737 | 745 | | |
738 | 746 | | |
739 | 747 | | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
740 | 752 | | |
741 | 753 | | |
742 | 754 | | |
| |||
749 | 761 | | |
750 | 762 | | |
751 | 763 | | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
752 | 794 | | |
753 | 795 | | |
754 | 796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
228 | 238 | | |
229 | 239 | | |
230 | 240 | | |
| |||
234 | 244 | | |
235 | 245 | | |
236 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
237 | 253 | | |
238 | 254 | | |
239 | 255 | | |
| |||
461 | 477 | | |
462 | 478 | | |
463 | 479 | | |
| 480 | + | |
464 | 481 | | |
465 | 482 | | |
466 | 483 | | |
| |||
528 | 545 | | |
529 | 546 | | |
530 | 547 | | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
531 | 552 | | |
532 | 553 | | |
533 | 554 | | |
| |||
551 | 572 | | |
552 | 573 | | |
553 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
554 | 605 | | |
555 | 606 | | |
556 | 607 | | |
| |||
0 commit comments