diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-06 11:49:28 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-06 13:09:49 +0100 |
| commit | 47271a823485c002ab6c3f304b86dbba2d7594dd (patch) | |
| tree | 75d06b6e6c4c3f3b82baf3b5565b8471243b85e6 /tests | |
| parent | f1aa1be738af0dc80eb3b5827249bb537de1e0cd (diff) | |
feat(remote): `fetch` report on progress
so that user knows what step we are on
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/git_remote_helper.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/git_remote_helper.rs b/tests/git_remote_helper.rs index 77d7ecb..f86cb7a 100644 --- a/tests/git_remote_helper.rs +++ b/tests/git_remote_helper.rs | |||
| @@ -558,6 +558,8 @@ mod fetch { | |||
| 558 | #[serial] | 558 | #[serial] |
| 559 | async fn fetch_downloads_speficied_commits_from_git_server() -> Result<()> { | 559 | async fn fetch_downloads_speficied_commits_from_git_server() -> Result<()> { |
| 560 | let source_git_repo = prep_git_repo()?; | 560 | let source_git_repo = prep_git_repo()?; |
| 561 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | ||
| 562 | |||
| 561 | std::fs::write(source_git_repo.dir.join("commit.md"), "some content")?; | 563 | std::fs::write(source_git_repo.dir.join("commit.md"), "some content")?; |
| 562 | let main_commit_id = source_git_repo.stage_and_commit("commit.md")?; | 564 | let main_commit_id = source_git_repo.stage_and_commit("commit.md")?; |
| 563 | 565 | ||
| @@ -594,7 +596,8 @@ mod fetch { | |||
| 594 | p.send_line(format!("fetch {main_commit_id} main").as_str())?; | 596 | p.send_line(format!("fetch {main_commit_id} main").as_str())?; |
| 595 | p.send_line(format!("fetch {vnext_commit_id} vnext").as_str())?; | 597 | p.send_line(format!("fetch {vnext_commit_id} vnext").as_str())?; |
| 596 | p.send_line("")?; | 598 | p.send_line("")?; |
| 597 | p.expect("\r\n")?; | 599 | p.expect(format!("fetching from {source_path}...\r\n").as_str())?; |
| 600 | p.expect_eventually_and_print("\r\n")?; | ||
| 598 | 601 | ||
| 599 | assert!(git_repo.git_repo.find_commit(main_commit_id).is_ok()); | 602 | assert!(git_repo.git_repo.find_commit(main_commit_id).is_ok()); |
| 600 | assert!(git_repo.git_repo.find_commit(vnext_commit_id).is_ok()); | 603 | assert!(git_repo.git_repo.find_commit(vnext_commit_id).is_ok()); |
| @@ -625,6 +628,8 @@ mod fetch { | |||
| 625 | #[serial] | 628 | #[serial] |
| 626 | async fn fetch_downloads_speficied_commits_from_second_git_server() -> Result<()> { | 629 | async fn fetch_downloads_speficied_commits_from_second_git_server() -> Result<()> { |
| 627 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; | 630 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; |
| 631 | // let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | ||
| 632 | let error_path = "./path-doesnt-exist".to_string(); | ||
| 628 | 633 | ||
| 629 | let main_commit_id = source_git_repo.get_tip_of_local_branch("main")?; | 634 | let main_commit_id = source_git_repo.get_tip_of_local_branch("main")?; |
| 630 | 635 | ||
| @@ -634,7 +639,7 @@ mod fetch { | |||
| 634 | generate_test_key_1_metadata_event("fred"), | 639 | generate_test_key_1_metadata_event("fred"), |
| 635 | generate_test_key_1_relay_list_event(), | 640 | generate_test_key_1_relay_list_event(), |
| 636 | generate_repo_ref_event_with_git_server(vec![ | 641 | generate_repo_ref_event_with_git_server(vec![ |
| 637 | "./path-doesnt-exist".to_string(), | 642 | error_path.to_string(), |
| 638 | source_git_repo.dir.to_str().unwrap().to_string(), | 643 | source_git_repo.dir.to_str().unwrap().to_string(), |
| 639 | ]), | 644 | ]), |
| 640 | state_event, | 645 | state_event, |
| @@ -657,7 +662,11 @@ mod fetch { | |||
| 657 | let mut p = cli_tester_after_fetch(&git_repo)?; | 662 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 658 | p.send_line(format!("fetch {main_commit_id} main").as_str())?; | 663 | p.send_line(format!("fetch {main_commit_id} main").as_str())?; |
| 659 | p.send_line("")?; | 664 | p.send_line("")?; |
| 660 | p.expect("\r\n")?; | 665 | p.expect(format!("fetching from {error_path}...\r\n").as_str())?; |
| 666 | // not sure why the below isn't appearing | ||
| 667 | // p.expect(format!("fetching from {source_path}...\r\n").as_str())?; | ||
| 668 | p.expect_eventually_and_print("\r\n")?; | ||
| 669 | // p.expect("\r\n")?; | ||
| 661 | 670 | ||
| 662 | assert!(git_repo.git_repo.find_commit(main_commit_id).is_ok()); | 671 | assert!(git_repo.git_repo.find_commit(main_commit_id).is_ok()); |
| 663 | 672 | ||