diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/list.rs | 206 |
1 files changed, 159 insertions, 47 deletions
diff --git a/tests/list.rs b/tests/list.rs index e072ff5..0c138d5 100644 --- a/tests/list.rs +++ b/tests/list.rs | |||
| @@ -249,8 +249,8 @@ mod when_main_branch_is_uptodate { | |||
| 249 | r55.events.push(generate_test_key_1_metadata_event("fred")); | 249 | r55.events.push(generate_test_key_1_metadata_event("fred")); |
| 250 | r55.events.push(generate_test_key_1_relay_list_event()); | 250 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 251 | 251 | ||
| 252 | let cli_tester_handle = | 252 | let cli_tester_handle = std::thread::spawn( |
| 253 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 253 | move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 254 | let originating_repo = cli_tester_create_proposals()?; | 254 | let originating_repo = cli_tester_create_proposals()?; |
| 255 | 255 | ||
| 256 | let test_repo = GitTestRepo::default(); | 256 | let test_repo = GitTestRepo::default(); |
| @@ -267,16 +267,29 @@ mod when_main_branch_is_uptodate { | |||
| 267 | ], | 267 | ], |
| 268 | )?; | 268 | )?; |
| 269 | c.succeeds_with(0, true)?; | 269 | c.succeeds_with(0, true)?; |
| 270 | let mut confirm = | ||
| 271 | p.expect_confirm_eventually("check out branch?", Some(true))?; | ||
| 272 | confirm.succeeds_with(None)?; | ||
| 273 | p.expect_end_eventually_and_print()?; | ||
| 274 | 270 | ||
| 271 | p.expect("finding commits...\r\n")?; | ||
| 272 | let mut c = p.expect_choice( | ||
| 273 | "", | ||
| 274 | vec![ | ||
| 275 | format!( | ||
| 276 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | ||
| 277 | format!("apply to current branch with `git am`"), | ||
| 278 | format!("download to ./patches"), | ||
| 279 | format!("back"), | ||
| 280 | ], | ||
| 281 | )?; | ||
| 282 | c.succeeds_with(0, false)?; | ||
| 283 | p.expect(format!( | ||
| 284 | "checked out proposal as '{FEATURE_BRANCH_NAME_1}' branch\r\n" | ||
| 285 | ))?; | ||
| 286 | p.expect_end()?; | ||
| 275 | for p in [51, 52, 53, 55, 56] { | 287 | for p in [51, 52, 53, 55, 56] { |
| 276 | relay::shutdown_relay(8000 + p)?; | 288 | relay::shutdown_relay(8000 + p)?; |
| 277 | } | 289 | } |
| 278 | Ok((originating_repo, test_repo)) | 290 | Ok((originating_repo, test_repo)) |
| 279 | }); | 291 | }, |
| 292 | ); | ||
| 280 | 293 | ||
| 281 | // launch relay | 294 | // launch relay |
| 282 | let _ = join!( | 295 | let _ = join!( |
| @@ -328,9 +341,20 @@ mod when_main_branch_is_uptodate { | |||
| 328 | )?; | 341 | )?; |
| 329 | c.succeeds_with(0, true)?; | 342 | c.succeeds_with(0, true)?; |
| 330 | p.expect("finding commits...\r\n")?; | 343 | p.expect("finding commits...\r\n")?; |
| 331 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 344 | let mut c = p.expect_choice( |
| 332 | confirm.succeeds_with(None)?; | 345 | "", |
| 333 | p.expect("checked out proposal branch. pulled 2 new commits\r\n")?; | 346 | vec![ |
| 347 | format!( | ||
| 348 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | ||
| 349 | format!("apply to current branch with `git am`"), | ||
| 350 | format!("download to ./patches"), | ||
| 351 | format!("back"), | ||
| 352 | ], | ||
| 353 | )?; | ||
| 354 | c.succeeds_with(0, false)?; | ||
| 355 | p.expect(format!( | ||
| 356 | "checked out proposal as '{FEATURE_BRANCH_NAME_1}' branch\r\n" | ||
| 357 | ))?; | ||
| 334 | p.expect_end()?; | 358 | p.expect_end()?; |
| 335 | 359 | ||
| 336 | for p in [51, 52, 53, 55, 56] { | 360 | for p in [51, 52, 53, 55, 56] { |
| @@ -414,8 +438,8 @@ mod when_main_branch_is_uptodate { | |||
| 414 | r55.events.push(generate_test_key_1_metadata_event("fred")); | 438 | r55.events.push(generate_test_key_1_metadata_event("fred")); |
| 415 | r55.events.push(generate_test_key_1_relay_list_event()); | 439 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 416 | 440 | ||
| 417 | let cli_tester_handle = | 441 | let cli_tester_handle = std::thread::spawn( |
| 418 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 442 | move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 419 | let originating_repo = cli_tester_create_proposals()?; | 443 | let originating_repo = cli_tester_create_proposals()?; |
| 420 | 444 | ||
| 421 | let test_repo = GitTestRepo::default(); | 445 | let test_repo = GitTestRepo::default(); |
| @@ -432,16 +456,30 @@ mod when_main_branch_is_uptodate { | |||
| 432 | ], | 456 | ], |
| 433 | )?; | 457 | )?; |
| 434 | c.succeeds_with(2, true)?; | 458 | c.succeeds_with(2, true)?; |
| 435 | let mut confirm = | 459 | |
| 436 | p.expect_confirm_eventually("check out branch?", Some(true))?; | 460 | p.expect("finding commits...\r\n")?; |
| 437 | confirm.succeeds_with(None)?; | 461 | let mut c = p.expect_choice( |
| 438 | p.expect_end_eventually_and_print()?; | 462 | "", |
| 463 | vec![ | ||
| 464 | format!( | ||
| 465 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | ||
| 466 | format!("apply to current branch with `git am`"), | ||
| 467 | format!("download to ./patches"), | ||
| 468 | format!("back"), | ||
| 469 | ], | ||
| 470 | )?; | ||
| 471 | c.succeeds_with(0, false)?; | ||
| 472 | p.expect(format!( | ||
| 473 | "checked out proposal as '{FEATURE_BRANCH_NAME_3}' branch\r\n" | ||
| 474 | ))?; | ||
| 475 | p.expect_end()?; | ||
| 439 | 476 | ||
| 440 | for p in [51, 52, 53, 55, 56] { | 477 | for p in [51, 52, 53, 55, 56] { |
| 441 | relay::shutdown_relay(8000 + p)?; | 478 | relay::shutdown_relay(8000 + p)?; |
| 442 | } | 479 | } |
| 443 | Ok((originating_repo, test_repo)) | 480 | Ok((originating_repo, test_repo)) |
| 444 | }); | 481 | }, |
| 482 | ); | ||
| 445 | 483 | ||
| 446 | // launch relay | 484 | // launch relay |
| 447 | let _ = join!( | 485 | let _ = join!( |
| @@ -493,9 +531,20 @@ mod when_main_branch_is_uptodate { | |||
| 493 | )?; | 531 | )?; |
| 494 | c.succeeds_with(2, true)?; | 532 | c.succeeds_with(2, true)?; |
| 495 | p.expect("finding commits...\r\n")?; | 533 | p.expect("finding commits...\r\n")?; |
| 496 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 534 | let mut c = p.expect_choice( |
| 497 | confirm.succeeds_with(None)?; | 535 | "", |
| 498 | p.expect("checked out proposal branch. pulled 2 new commits\r\n")?; | 536 | vec![ |
| 537 | format!( | ||
| 538 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | ||
| 539 | format!("apply to current branch with `git am`"), | ||
| 540 | format!("download to ./patches"), | ||
| 541 | format!("back"), | ||
| 542 | ], | ||
| 543 | )?; | ||
| 544 | c.succeeds_with(0, false)?; | ||
| 545 | p.expect(format!( | ||
| 546 | "checked out proposal as '{FEATURE_BRANCH_NAME_3}' branch\r\n" | ||
| 547 | ))?; | ||
| 499 | p.expect_end()?; | 548 | p.expect_end()?; |
| 500 | 549 | ||
| 501 | for p in [51, 52, 53, 55, 56] { | 550 | for p in [51, 52, 53, 55, 56] { |
| @@ -579,8 +628,8 @@ mod when_main_branch_is_uptodate { | |||
| 579 | r55.events.push(generate_test_key_1_metadata_event("fred")); | 628 | r55.events.push(generate_test_key_1_metadata_event("fred")); |
| 580 | r55.events.push(generate_test_key_1_relay_list_event()); | 629 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 581 | 630 | ||
| 582 | let cli_tester_handle = | 631 | let cli_tester_handle = std::thread::spawn( |
| 583 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 632 | move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 584 | let originating_repo = cli_tester_create_proposals()?; | 633 | let originating_repo = cli_tester_create_proposals()?; |
| 585 | cli_tester_create_proposal( | 634 | cli_tester_create_proposal( |
| 586 | &originating_repo, | 635 | &originating_repo, |
| @@ -603,16 +652,29 @@ mod when_main_branch_is_uptodate { | |||
| 603 | ], | 652 | ], |
| 604 | )?; | 653 | )?; |
| 605 | c.succeeds_with(3, true)?; | 654 | c.succeeds_with(3, true)?; |
| 606 | let mut confirm = | 655 | p.expect("finding commits...\r\n")?; |
| 607 | p.expect_confirm_eventually("check out branch?", Some(true))?; | 656 | let mut c = p.expect_choice( |
| 608 | confirm.succeeds_with(None)?; | 657 | "", |
| 609 | p.expect_end_eventually_and_print()?; | 658 | vec![ |
| 659 | format!( | ||
| 660 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | ||
| 661 | format!("apply to current branch with `git am`"), | ||
| 662 | format!("download to ./patches"), | ||
| 663 | format!("back"), | ||
| 664 | ], | ||
| 665 | )?; | ||
| 666 | c.succeeds_with(0, false)?; | ||
| 667 | p.expect(format!( | ||
| 668 | "checked out proposal as '{FEATURE_BRANCH_NAME_4}' branch\r\n" | ||
| 669 | ))?; | ||
| 670 | p.expect_end()?; | ||
| 610 | 671 | ||
| 611 | for p in [51, 52, 53, 55, 56] { | 672 | for p in [51, 52, 53, 55, 56] { |
| 612 | relay::shutdown_relay(8000 + p)?; | 673 | relay::shutdown_relay(8000 + p)?; |
| 613 | } | 674 | } |
| 614 | Ok((originating_repo, test_repo)) | 675 | Ok((originating_repo, test_repo)) |
| 615 | }); | 676 | }, |
| 677 | ); | ||
| 616 | 678 | ||
| 617 | // launch relay | 679 | // launch relay |
| 618 | let _ = join!( | 680 | let _ = join!( |
| @@ -670,9 +732,20 @@ mod when_main_branch_is_uptodate { | |||
| 670 | )?; | 732 | )?; |
| 671 | c.succeeds_with(3, true)?; | 733 | c.succeeds_with(3, true)?; |
| 672 | p.expect("finding commits...\r\n")?; | 734 | p.expect("finding commits...\r\n")?; |
| 673 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 735 | let mut c = p.expect_choice( |
| 674 | confirm.succeeds_with(None)?; | 736 | "", |
| 675 | p.expect("checked out proposal branch. pulled 2 new commits\r\n")?; | 737 | vec![ |
| 738 | format!( | ||
| 739 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | ||
| 740 | format!("apply to current branch with `git am`"), | ||
| 741 | format!("download to ./patches"), | ||
| 742 | format!("back"), | ||
| 743 | ], | ||
| 744 | )?; | ||
| 745 | c.succeeds_with(0, false)?; | ||
| 746 | p.expect(format!( | ||
| 747 | "checked out proposal as '{FEATURE_BRANCH_NAME_4}' branch\r\n" | ||
| 748 | ))?; | ||
| 676 | p.expect_end()?; | 749 | p.expect_end()?; |
| 677 | 750 | ||
| 678 | for p in [51, 52, 53, 55, 56] { | 751 | for p in [51, 52, 53, 55, 56] { |
| @@ -789,10 +862,21 @@ mod when_main_branch_is_uptodate { | |||
| 789 | ], | 862 | ], |
| 790 | )?; | 863 | )?; |
| 791 | c.succeeds_with(0, true)?; | 864 | c.succeeds_with(0, true)?; |
| 792 | let mut confirm = | 865 | p.expect("finding commits...\r\n")?; |
| 793 | p.expect_confirm_eventually("check out branch?", Some(true))?; | 866 | let mut c = p.expect_choice( |
| 794 | confirm.succeeds_with(None)?; | 867 | "", |
| 795 | p.expect_end_eventually_and_print()?; | 868 | vec![ |
| 869 | format!("checkout proposal branch (2 ahead 0 behind 'main')"), | ||
| 870 | format!("apply to current branch with `git am`"), | ||
| 871 | format!("download to ./patches"), | ||
| 872 | format!("back"), | ||
| 873 | ], | ||
| 874 | )?; | ||
| 875 | c.succeeds_with(0, false)?; | ||
| 876 | p.expect(format!( | ||
| 877 | "checked out proposal as '{FEATURE_BRANCH_NAME_1}' branch\r\n" | ||
| 878 | ))?; | ||
| 879 | p.expect_end()?; | ||
| 796 | 880 | ||
| 797 | for p in [51, 52, 53, 55, 56] { | 881 | for p in [51, 52, 53, 55, 56] { |
| 798 | relay::shutdown_relay(8000 + p)?; | 882 | relay::shutdown_relay(8000 + p)?; |
| @@ -858,9 +942,19 @@ mod when_main_branch_is_uptodate { | |||
| 858 | )?; | 942 | )?; |
| 859 | c.succeeds_with(0, true)?; | 943 | c.succeeds_with(0, true)?; |
| 860 | p.expect("finding commits...\r\n")?; | 944 | p.expect("finding commits...\r\n")?; |
| 861 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 945 | let mut c = p.expect_choice( |
| 862 | confirm.succeeds_with(None)?; | 946 | "", |
| 863 | p.expect("checked out proposal branch. no new commits to pull\r\n")?; | 947 | vec![ |
| 948 | format!("checkout proposal branch (2 ahead 0 behind 'main')"), | ||
| 949 | format!("apply to current branch with `git am`"), | ||
| 950 | format!("download to ./patches"), | ||
| 951 | format!("back"), | ||
| 952 | ], | ||
| 953 | )?; | ||
| 954 | c.succeeds_with(0, false)?; | ||
| 955 | p.expect(format!( | ||
| 956 | "checked out proposal as '{FEATURE_BRANCH_NAME_1}' branch\r\n" | ||
| 957 | ))?; | ||
| 864 | p.expect_end()?; | 958 | p.expect_end()?; |
| 865 | 959 | ||
| 866 | for p in [51, 52, 53, 55, 56] { | 960 | for p in [51, 52, 53, 55, 56] { |
| @@ -923,8 +1017,8 @@ mod when_main_branch_is_uptodate { | |||
| 923 | r55.events.push(generate_test_key_1_metadata_event("fred")); | 1017 | r55.events.push(generate_test_key_1_metadata_event("fred")); |
| 924 | r55.events.push(generate_test_key_1_relay_list_event()); | 1018 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 925 | 1019 | ||
| 926 | let cli_tester_handle = | 1020 | let cli_tester_handle = std::thread::spawn( |
| 927 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 1021 | move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 928 | let originating_repo = cli_tester_create_proposals()?; | 1022 | let originating_repo = cli_tester_create_proposals()?; |
| 929 | 1023 | ||
| 930 | let test_repo = GitTestRepo::default(); | 1024 | let test_repo = GitTestRepo::default(); |
| @@ -949,16 +1043,26 @@ mod when_main_branch_is_uptodate { | |||
| 949 | ], | 1043 | ], |
| 950 | )?; | 1044 | )?; |
| 951 | c.succeeds_with(0, true)?; | 1045 | c.succeeds_with(0, true)?; |
| 952 | let mut confirm = | 1046 | p.expect("finding commits...\r\n")?; |
| 953 | p.expect_confirm_eventually("check out branch?", Some(true))?; | 1047 | let mut c = p.expect_choice( |
| 954 | confirm.succeeds_with(None)?; | 1048 | "", |
| 955 | p.expect_end_eventually_and_print()?; | 1049 | vec![ |
| 1050 | format!("checkout proposal branch and apply 1 appendments"), | ||
| 1051 | format!("apply to current branch with `git am`"), | ||
| 1052 | format!("download to ./patches"), | ||
| 1053 | format!("back"), | ||
| 1054 | ], | ||
| 1055 | )?; | ||
| 1056 | c.succeeds_with(0, false)?; | ||
| 1057 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; | ||
| 1058 | p.expect_end()?; | ||
| 956 | 1059 | ||
| 957 | for p in [51, 52, 53, 55, 56] { | 1060 | for p in [51, 52, 53, 55, 56] { |
| 958 | relay::shutdown_relay(8000 + p)?; | 1061 | relay::shutdown_relay(8000 + p)?; |
| 959 | } | 1062 | } |
| 960 | Ok((originating_repo, test_repo)) | 1063 | Ok((originating_repo, test_repo)) |
| 961 | }); | 1064 | }, |
| 1065 | ); | ||
| 962 | 1066 | ||
| 963 | // launch relay | 1067 | // launch relay |
| 964 | let _ = join!( | 1068 | let _ = join!( |
| @@ -1018,9 +1122,17 @@ mod when_main_branch_is_uptodate { | |||
| 1018 | )?; | 1122 | )?; |
| 1019 | c.succeeds_with(0, true)?; | 1123 | c.succeeds_with(0, true)?; |
| 1020 | p.expect("finding commits...\r\n")?; | 1124 | p.expect("finding commits...\r\n")?; |
| 1021 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 1125 | let mut c = p.expect_choice( |
| 1022 | confirm.succeeds_with(None)?; | 1126 | "", |
| 1023 | p.expect("checked out proposal branch. pulled 1 new commits\r\n")?; | 1127 | vec![ |
| 1128 | format!("checkout proposal branch and apply 1 appendments"), | ||
| 1129 | format!("apply to current branch with `git am`"), | ||
| 1130 | format!("download to ./patches"), | ||
| 1131 | format!("back"), | ||
| 1132 | ], | ||
| 1133 | )?; | ||
| 1134 | c.succeeds_with(0, false)?; | ||
| 1135 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; | ||
| 1024 | p.expect_end()?; | 1136 | p.expect_end()?; |
| 1025 | 1137 | ||
| 1026 | for p in [51, 52, 53, 55, 56] { | 1138 | for p in [51, 52, 53, 55, 56] { |