diff options
Diffstat (limited to 'tests/git_remote_nostr')
| -rw-r--r-- | tests/git_remote_nostr/list.rs | 29 | ||||
| -rw-r--r-- | tests/git_remote_nostr/push.rs | 30 |
2 files changed, 20 insertions, 39 deletions
diff --git a/tests/git_remote_nostr/list.rs b/tests/git_remote_nostr/list.rs index 8723b54..88bd3f7 100644 --- a/tests/git_remote_nostr/list.rs +++ b/tests/git_remote_nostr/list.rs | |||
| @@ -8,7 +8,7 @@ mod without_state_announcement { | |||
| 8 | #[serial] | 8 | #[serial] |
| 9 | async fn lists_head_and_2_branches_and_commit_ids_from_git_server() -> Result<()> { | 9 | async fn lists_head_and_2_branches_and_commit_ids_from_git_server() -> Result<()> { |
| 10 | let source_git_repo = prep_git_repo()?; | 10 | let source_git_repo = prep_git_repo()?; |
| 11 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 11 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 12 | std::fs::write(source_git_repo.dir.join("commit.md"), "some content")?; | 12 | std::fs::write(source_git_repo.dir.join("commit.md"), "some content")?; |
| 13 | let main_commit_id = source_git_repo.stage_and_commit("commit.md")?; | 13 | let main_commit_id = source_git_repo.stage_and_commit("commit.md")?; |
| 14 | 14 | ||
| @@ -41,8 +41,7 @@ mod without_state_announcement { | |||
| 41 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 41 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 42 | let mut p = cli_tester_after_fetch(&git_repo)?; | 42 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 43 | p.send_line("list")?; | 43 | p.send_line("list")?; |
| 44 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 44 | p.expect("git servers: listing refs...\r\n")?; |
| 45 | p.expect("list: connecting...\r\n\r")?; | ||
| 46 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 45 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
| 47 | let res = p.expect_eventually("\r\n\r\n")?; | 46 | let res = p.expect_eventually("\r\n\r\n")?; |
| 48 | p.exit()?; | 47 | p.exit()?; |
| @@ -90,7 +89,7 @@ mod with_state_announcement { | |||
| 90 | #[serial] | 89 | #[serial] |
| 91 | async fn lists_head_and_2_branches_and_commit_ids_announcement() -> Result<()> { | 90 | async fn lists_head_and_2_branches_and_commit_ids_announcement() -> Result<()> { |
| 92 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; | 91 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; |
| 93 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 92 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 94 | 93 | ||
| 95 | let main_commit_id = source_git_repo.get_tip_of_local_branch("main")?; | 94 | let main_commit_id = source_git_repo.get_tip_of_local_branch("main")?; |
| 96 | let example_commit_id = source_git_repo.get_tip_of_local_branch("example-branch")?; | 95 | let example_commit_id = source_git_repo.get_tip_of_local_branch("example-branch")?; |
| @@ -119,10 +118,7 @@ mod with_state_announcement { | |||
| 119 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 118 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 120 | let mut p = cli_tester_after_fetch(&git_repo)?; | 119 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 121 | p.send_line("list")?; | 120 | p.send_line("list")?; |
| 122 | p.expect( | 121 | p.expect("git servers: listing refs...\r\n")?; |
| 123 | format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), | ||
| 124 | )?; | ||
| 125 | p.expect("list: connecting...\r\n\r")?; | ||
| 126 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 122 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
| 127 | let res = p.expect_eventually("\r\n\r\n")?; | 123 | let res = p.expect_eventually("\r\n\r\n")?; |
| 128 | p.exit()?; | 124 | p.exit()?; |
| @@ -163,7 +159,7 @@ mod with_state_announcement { | |||
| 163 | #[serial] | 159 | #[serial] |
| 164 | async fn anouncement_state_is_used() -> Result<()> { | 160 | async fn anouncement_state_is_used() -> Result<()> { |
| 165 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; | 161 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; |
| 166 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 162 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 167 | let main_original_commit_id = source_git_repo.get_tip_of_local_branch("main")?; | 163 | let main_original_commit_id = source_git_repo.get_tip_of_local_branch("main")?; |
| 168 | 164 | ||
| 169 | { | 165 | { |
| @@ -203,13 +199,7 @@ mod with_state_announcement { | |||
| 203 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 199 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 204 | let mut p = cli_tester_after_fetch(&git_repo)?; | 200 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 205 | p.send_line("list")?; | 201 | p.send_line("list")?; |
| 206 | p.expect( | 202 | p.expect("git servers: listing refs...\r\n")?; |
| 207 | format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), | ||
| 208 | )?; | ||
| 209 | p.expect("list: connecting...\r\n\r")?; | ||
| 210 | p.expect( | ||
| 211 | format!("WARNING: {source_path} is out of sync. main out of sync\r\n").as_str(), | ||
| 212 | )?; | ||
| 213 | 203 | ||
| 214 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 204 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
| 215 | let res = p.expect_eventually("\r\n\r\n")?; | 205 | let res = p.expect_eventually("\r\n\r\n")?; |
| @@ -255,7 +245,7 @@ mod with_state_announcement { | |||
| 255 | #[serial] | 245 | #[serial] |
| 256 | async fn open_proposal_listed_in_prs_namespace() -> Result<()> { | 246 | async fn open_proposal_listed_in_prs_namespace() -> Result<()> { |
| 257 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; | 247 | let (state_event, source_git_repo) = generate_repo_with_state_event().await?; |
| 258 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 248 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 259 | 249 | ||
| 260 | let main_commit_id = source_git_repo.get_tip_of_local_branch("main")?; | 250 | let main_commit_id = source_git_repo.get_tip_of_local_branch("main")?; |
| 261 | let example_commit_id = source_git_repo.get_tip_of_local_branch("example-branch")?; | 251 | let example_commit_id = source_git_repo.get_tip_of_local_branch("example-branch")?; |
| @@ -287,10 +277,7 @@ mod with_state_announcement { | |||
| 287 | 277 | ||
| 288 | let mut p = cli_tester_after_fetch(&git_repo)?; | 278 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 289 | p.send_line("list")?; | 279 | p.send_line("list")?; |
| 290 | p.expect( | 280 | p.expect("git servers: listing refs...\r\n")?; |
| 291 | format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), | ||
| 292 | )?; | ||
| 293 | p.expect("list: connecting...\r\n\r")?; | ||
| 294 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 281 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
| 295 | let res = p.expect_eventually("\r\n\r\n")?; | 282 | let res = p.expect_eventually("\r\n\r\n")?; |
| 296 | 283 | ||
diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs index 647a2f3..404d07f 100644 --- a/tests/git_remote_nostr/push.rs +++ b/tests/git_remote_nostr/push.rs | |||
| @@ -845,7 +845,7 @@ async fn pushes_to_all_git_servers_listed_and_ok_printed() -> Result<()> { | |||
| 845 | async fn proposal_three_way_merge_commit_pushed_to_main_leads_to_status_event_issued() -> Result<()> | 845 | async fn proposal_three_way_merge_commit_pushed_to_main_leads_to_status_event_issued() -> Result<()> |
| 846 | { | 846 | { |
| 847 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; | 847 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; |
| 848 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 848 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 849 | 849 | ||
| 850 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( | 850 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( |
| 851 | Relay::new(8051, None, None), | 851 | Relay::new(8051, None, None), |
| @@ -881,8 +881,7 @@ async fn proposal_three_way_merge_commit_pushed_to_main_leads_to_status_event_is | |||
| 881 | 881 | ||
| 882 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 882 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 883 | cli_expect_nostr_fetch(&mut p)?; | 883 | cli_expect_nostr_fetch(&mut p)?; |
| 884 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 884 | p.expect("git servers: listing refs...\r\n")?; |
| 885 | p.expect("list: connecting...\r\n")?; | ||
| 886 | p.expect_eventually("merge commit ")?; | 885 | p.expect_eventually("merge commit ")?; |
| 887 | // shorthand merge commit id appears in this gap | 886 | // shorthand merge commit id appears in this gap |
| 888 | p.expect_eventually(": create nostr proposal status event\r\n")?; | 887 | p.expect_eventually(": create nostr proposal status event\r\n")?; |
| @@ -1002,7 +1001,7 @@ async fn proposal_fast_forward_merge_commits_pushed_to_main_leads_to_status_even | |||
| 1002 | -> Result<()> { | 1001 | -> Result<()> { |
| 1003 | // | 1002 | // |
| 1004 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; | 1003 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; |
| 1005 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 1004 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 1006 | 1005 | ||
| 1007 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( | 1006 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( |
| 1008 | Relay::new(8051, None, None), | 1007 | Relay::new(8051, None, None), |
| @@ -1035,8 +1034,7 @@ async fn proposal_fast_forward_merge_commits_pushed_to_main_leads_to_status_even | |||
| 1035 | 1034 | ||
| 1036 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1035 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1037 | cli_expect_nostr_fetch(&mut p)?; | 1036 | cli_expect_nostr_fetch(&mut p)?; |
| 1038 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 1037 | p.expect("git servers: listing refs...\r\n")?; |
| 1039 | p.expect("list: connecting...\r\n")?; | ||
| 1040 | p.expect_eventually(format!( | 1038 | p.expect_eventually(format!( |
| 1041 | "fast-forward merge: create nostr proposal status event for {branch_name}\r\n" | 1039 | "fast-forward merge: create nostr proposal status event for {branch_name}\r\n" |
| 1042 | ))?; | 1040 | ))?; |
| @@ -1184,7 +1182,7 @@ async fn proposal_fast_forward_merge_commits_pushed_to_main_leads_to_status_even | |||
| 1184 | async fn proposal_commits_applied_and_pushed_to_main_leads_to_status_event_issued() -> Result<()> { | 1182 | async fn proposal_commits_applied_and_pushed_to_main_leads_to_status_event_issued() -> Result<()> { |
| 1185 | // | 1183 | // |
| 1186 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; | 1184 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; |
| 1187 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 1185 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 1188 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( | 1186 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( |
| 1189 | Relay::new(8051, None, None), | 1187 | Relay::new(8051, None, None), |
| 1190 | Relay::new(8052, None, None), | 1188 | Relay::new(8052, None, None), |
| @@ -1222,8 +1220,7 @@ async fn proposal_commits_applied_and_pushed_to_main_leads_to_status_event_issue | |||
| 1222 | 1220 | ||
| 1223 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1221 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1224 | cli_expect_nostr_fetch(&mut p)?; | 1222 | cli_expect_nostr_fetch(&mut p)?; |
| 1225 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 1223 | p.expect("git servers: listing refs...\r\n")?; |
| 1226 | p.expect("list: connecting...\r\n")?; | ||
| 1227 | p.expect_eventually(format!( | 1224 | p.expect_eventually(format!( |
| 1228 | "applied commits from proposal: create nostr proposal status event for {branch_name}\r\n" ))?; | 1225 | "applied commits from proposal: create nostr proposal status event for {branch_name}\r\n" ))?; |
| 1229 | // status updates printed here | 1226 | // status updates printed here |
| @@ -1354,7 +1351,7 @@ async fn proposal_commits_applied_and_pushed_to_main_leads_to_status_event_issue | |||
| 1354 | #[serial] | 1351 | #[serial] |
| 1355 | async fn push_2_commits_to_existing_proposal() -> Result<()> { | 1352 | async fn push_2_commits_to_existing_proposal() -> Result<()> { |
| 1356 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; | 1353 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; |
| 1357 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 1354 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 1358 | 1355 | ||
| 1359 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( | 1356 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( |
| 1360 | Relay::new(8051, None, None), | 1357 | Relay::new(8051, None, None), |
| @@ -1384,8 +1381,7 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> { | |||
| 1384 | 1381 | ||
| 1385 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1382 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1386 | cli_expect_nostr_fetch(&mut p)?; | 1383 | cli_expect_nostr_fetch(&mut p)?; |
| 1387 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 1384 | p.expect("git servers: listing refs...\r\n")?; |
| 1388 | p.expect("list: connecting...\r\n\r")?; | ||
| 1389 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1385 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1390 | let output = p.expect_end_eventually()?; | 1386 | let output = p.expect_end_eventually()?; |
| 1391 | 1387 | ||
| @@ -1500,7 +1496,7 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> { | |||
| 1500 | #[serial] | 1496 | #[serial] |
| 1501 | async fn force_push_creates_proposal_revision() -> Result<()> { | 1497 | async fn force_push_creates_proposal_revision() -> Result<()> { |
| 1502 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; | 1498 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; |
| 1503 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 1499 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 1504 | 1500 | ||
| 1505 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( | 1501 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( |
| 1506 | Relay::new(8051, None, None), | 1502 | Relay::new(8051, None, None), |
| @@ -1539,8 +1535,7 @@ async fn force_push_creates_proposal_revision() -> Result<()> { | |||
| 1539 | let mut p = | 1535 | let mut p = |
| 1540 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push", "--force"]); | 1536 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push", "--force"]); |
| 1541 | cli_expect_nostr_fetch(&mut p)?; | 1537 | cli_expect_nostr_fetch(&mut p)?; |
| 1542 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 1538 | p.expect("git servers: listing refs...\r\n")?; |
| 1543 | p.expect("list: connecting...\r\n")?; | ||
| 1544 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1539 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1545 | let output = p.expect_end_eventually()?; | 1540 | let output = p.expect_end_eventually()?; |
| 1546 | 1541 | ||
| @@ -1659,7 +1654,7 @@ async fn force_push_creates_proposal_revision() -> Result<()> { | |||
| 1659 | #[serial] | 1654 | #[serial] |
| 1660 | async fn push_new_pr_branch_creates_proposal() -> Result<()> { | 1655 | async fn push_new_pr_branch_creates_proposal() -> Result<()> { |
| 1661 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; | 1656 | let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; |
| 1662 | let source_path = source_git_repo.dir.to_str().unwrap().to_string(); | 1657 | let _source_path = source_git_repo.dir.to_str().unwrap().to_string(); |
| 1663 | 1658 | ||
| 1664 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( | 1659 | let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( |
| 1665 | Relay::new(8051, None, None), | 1660 | Relay::new(8051, None, None), |
| @@ -1693,8 +1688,7 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> { | |||
| 1693 | ["push", "-u", "origin", branch_name], | 1688 | ["push", "-u", "origin", branch_name], |
| 1694 | ); | 1689 | ); |
| 1695 | cli_expect_nostr_fetch(&mut p)?; | 1690 | cli_expect_nostr_fetch(&mut p)?; |
| 1696 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; | 1691 | p.expect("git servers: listing refs...\r\n")?; |
| 1697 | p.expect("list: connecting...\r\n\r")?; | ||
| 1698 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1692 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1699 | let output = p.expect_end_eventually()?; | 1693 | let output = p.expect_end_eventually()?; |
| 1700 | 1694 | ||