diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-16 11:01:44 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-16 11:01:44 +0100 |
| commit | 7704178c618f8ac455cd6b0582edb511a9e644c3 (patch) | |
| tree | 775e425f0af2543eb12e4a4b1d4feb022611368f /tests/git_remote_nostr | |
| parent | 8cea674f58e806c22d2887cff5e6f76bc4dba0db (diff) | |
| parent | ac53bca7e315848864ff9e51703720b5b466bc42 (diff) | |
Merge branch 'upgrade-dependancies'
Diffstat (limited to 'tests/git_remote_nostr')
| -rw-r--r-- | tests/git_remote_nostr/list.rs | 23 | ||||
| -rw-r--r-- | tests/git_remote_nostr/push.rs | 42 |
2 files changed, 29 insertions, 36 deletions
diff --git a/tests/git_remote_nostr/list.rs b/tests/git_remote_nostr/list.rs index 37cff30..c201054 100644 --- a/tests/git_remote_nostr/list.rs +++ b/tests/git_remote_nostr/list.rs | |||
| @@ -41,7 +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 {} ref list over filesystem...\r\n", source_path).as_str())?; | 44 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 45 | p.expect("list: connecting...\r\n\r\r\r")?; | 45 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 46 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 46 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
| 47 | let res = p.expect_eventually("\r\n\r\n")?; | 47 | let res = p.expect_eventually("\r\n\r\n")?; |
| @@ -59,8 +59,8 @@ mod without_state_announcement { | |||
| 59 | .collect::<HashSet<String>>(), | 59 | .collect::<HashSet<String>>(), |
| 60 | HashSet::from([ | 60 | HashSet::from([ |
| 61 | "@refs/heads/main HEAD".to_string(), | 61 | "@refs/heads/main HEAD".to_string(), |
| 62 | format!("{} refs/heads/main", main_commit_id), | 62 | format!("{main_commit_id} refs/heads/main"), |
| 63 | format!("{} refs/heads/vnext", vnext_commit_id), | 63 | format!("{vnext_commit_id} refs/heads/vnext"), |
| 64 | ]), | 64 | ]), |
| 65 | ); | 65 | ); |
| 66 | Ok(()) | 66 | Ok(()) |
| @@ -120,7 +120,7 @@ mod with_state_announcement { | |||
| 120 | let mut p = cli_tester_after_fetch(&git_repo)?; | 120 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 121 | p.send_line("list")?; | 121 | p.send_line("list")?; |
| 122 | p.expect( | 122 | p.expect( |
| 123 | format!("fetching {} ref list over filesystem...\r\n", source_path).as_str(), | 123 | format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), |
| 124 | )?; | 124 | )?; |
| 125 | p.expect("list: connecting...\r\n\r\r\r")?; | 125 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 126 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 126 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
| @@ -135,8 +135,8 @@ mod with_state_announcement { | |||
| 135 | .collect::<HashSet<String>>(), | 135 | .collect::<HashSet<String>>(), |
| 136 | HashSet::from([ | 136 | HashSet::from([ |
| 137 | "@refs/heads/main HEAD".to_string(), | 137 | "@refs/heads/main HEAD".to_string(), |
| 138 | format!("{} refs/heads/main", main_commit_id), | 138 | format!("{main_commit_id} refs/heads/main"), |
| 139 | format!("{} refs/heads/example-branch", example_commit_id), | 139 | format!("{example_commit_id} refs/heads/example-branch"), |
| 140 | ]), | 140 | ]), |
| 141 | ); | 141 | ); |
| 142 | 142 | ||
| @@ -204,13 +204,12 @@ mod with_state_announcement { | |||
| 204 | let mut p = cli_tester_after_fetch(&git_repo)?; | 204 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 205 | p.send_line("list")?; | 205 | p.send_line("list")?; |
| 206 | p.expect( | 206 | p.expect( |
| 207 | format!("fetching {} ref list over filesystem...\r\n", source_path).as_str(), | 207 | format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), |
| 208 | )?; | 208 | )?; |
| 209 | p.expect("list: connecting...\r\n\r\r\r")?; | 209 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 210 | p.expect( | 210 | p.expect( |
| 211 | format!( | 211 | format!( |
| 212 | "WARNING: {} refs/heads/main is out of sync with nostr \r\n", | 212 | "WARNING: {source_path} refs/heads/main is out of sync with nostr \r\n" |
| 213 | source_path | ||
| 214 | ) | 213 | ) |
| 215 | .as_str(), | 214 | .as_str(), |
| 216 | )?; | 215 | )?; |
| @@ -231,8 +230,8 @@ mod with_state_announcement { | |||
| 231 | .collect::<HashSet<String>>(), | 230 | .collect::<HashSet<String>>(), |
| 232 | HashSet::from([ | 231 | HashSet::from([ |
| 233 | "@refs/heads/main HEAD".to_string(), | 232 | "@refs/heads/main HEAD".to_string(), |
| 234 | format!("{} refs/heads/main", main_original_commit_id), | 233 | format!("{main_original_commit_id} refs/heads/main"), |
| 235 | format!("{} refs/heads/example-branch", example_commit_id), | 234 | format!("{example_commit_id} refs/heads/example-branch"), |
| 236 | ]), | 235 | ]), |
| 237 | ); | 236 | ); |
| 238 | Ok(()) | 237 | Ok(()) |
| @@ -292,7 +291,7 @@ mod with_state_announcement { | |||
| 292 | let mut p = cli_tester_after_fetch(&git_repo)?; | 291 | let mut p = cli_tester_after_fetch(&git_repo)?; |
| 293 | p.send_line("list")?; | 292 | p.send_line("list")?; |
| 294 | p.expect( | 293 | p.expect( |
| 295 | format!("fetching {} ref list over filesystem...\r\n", source_path).as_str(), | 294 | format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), |
| 296 | )?; | 295 | )?; |
| 297 | p.expect("list: connecting...\r\n\r\r\r")?; | 296 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 298 | // println!("{}", p.expect_eventually("\r\n\r\n")?); | 297 | // println!("{}", p.expect_eventually("\r\n\r\n")?); |
diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs index f46b0ea..5912543 100644 --- a/tests/git_remote_nostr/push.rs +++ b/tests/git_remote_nostr/push.rs | |||
| @@ -969,19 +969,17 @@ async fn proposal_three_way_merge_commit_pushed_to_main_leads_to_status_event_is | |||
| 969 | std::fs::write(git_repo.dir.join("new.md"), "some content")?; | 969 | std::fs::write(git_repo.dir.join("new.md"), "some content")?; |
| 970 | git_repo.stage_and_commit("new.md")?; | 970 | git_repo.stage_and_commit("new.md")?; |
| 971 | 971 | ||
| 972 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, [ | 972 | CliTester::new_git_with_remote_helper_from_dir( |
| 973 | "merge", | 973 | &git_repo.dir, |
| 974 | &branch_name, | 974 | ["merge", &branch_name, "-m", "proposal merge commit message"], |
| 975 | "-m", | 975 | ) |
| 976 | "proposal merge commit message", | ||
| 977 | ]) | ||
| 978 | .expect_end_eventually_and_print()?; | 976 | .expect_end_eventually_and_print()?; |
| 979 | 977 | ||
| 980 | let oid = git_repo.get_tip_of_local_branch("main")?; | 978 | let oid = git_repo.get_tip_of_local_branch("main")?; |
| 981 | 979 | ||
| 982 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 980 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 983 | cli_expect_nostr_fetch(&mut p)?; | 981 | cli_expect_nostr_fetch(&mut p)?; |
| 984 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 982 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 985 | p.expect("list: connecting...\r\n")?; | 983 | p.expect("list: connecting...\r\n")?; |
| 986 | p.expect_eventually("merge commit ")?; | 984 | p.expect_eventually("merge commit ")?; |
| 987 | // shorthand merge commit id appears in this gap | 985 | // shorthand merge commit id appears in this gap |
| @@ -1125,19 +1123,17 @@ async fn proposal_fast_forward_merge_commits_pushed_to_main_leads_to_status_even | |||
| 1125 | git_repo.checkout_remote_branch(&branch_name)?; | 1123 | git_repo.checkout_remote_branch(&branch_name)?; |
| 1126 | git_repo.checkout("refs/heads/main")?; | 1124 | git_repo.checkout("refs/heads/main")?; |
| 1127 | 1125 | ||
| 1128 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, [ | 1126 | CliTester::new_git_with_remote_helper_from_dir( |
| 1129 | "merge", | 1127 | &git_repo.dir, |
| 1130 | &branch_name, | 1128 | ["merge", &branch_name, "-m", "proposal merge commit message"], |
| 1131 | "-m", | 1129 | ) |
| 1132 | "proposal merge commit message", | ||
| 1133 | ]) | ||
| 1134 | .expect_end_eventually_and_print()?; | 1130 | .expect_end_eventually_and_print()?; |
| 1135 | 1131 | ||
| 1136 | let oid = git_repo.get_tip_of_local_branch("main")?; | 1132 | let oid = git_repo.get_tip_of_local_branch("main")?; |
| 1137 | 1133 | ||
| 1138 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1134 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1139 | cli_expect_nostr_fetch(&mut p)?; | 1135 | cli_expect_nostr_fetch(&mut p)?; |
| 1140 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1136 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 1141 | p.expect("list: connecting...\r\n")?; | 1137 | p.expect("list: connecting...\r\n")?; |
| 1142 | p.expect_eventually(format!( | 1138 | p.expect_eventually(format!( |
| 1143 | "fast-forward merge: create nostr proposal status event for {branch_name}\r\n" | 1139 | "fast-forward merge: create nostr proposal status event for {branch_name}\r\n" |
| @@ -1323,7 +1319,7 @@ async fn proposal_commits_applied_and_pushed_to_main_leads_to_status_event_issue | |||
| 1323 | 1319 | ||
| 1324 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1320 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1325 | cli_expect_nostr_fetch(&mut p)?; | 1321 | cli_expect_nostr_fetch(&mut p)?; |
| 1326 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1322 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 1327 | p.expect("list: connecting...\r\n")?; | 1323 | p.expect("list: connecting...\r\n")?; |
| 1328 | p.expect_eventually(format!( | 1324 | p.expect_eventually(format!( |
| 1329 | "applied commits from proposal: create nostr proposal status event for {branch_name}\r\n" ))?; | 1325 | "applied commits from proposal: create nostr proposal status event for {branch_name}\r\n" ))?; |
| @@ -1484,7 +1480,7 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> { | |||
| 1484 | 1480 | ||
| 1485 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1481 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1486 | cli_expect_nostr_fetch(&mut p)?; | 1482 | cli_expect_nostr_fetch(&mut p)?; |
| 1487 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1483 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 1488 | p.expect("list: connecting...\r\n\r\r\r")?; | 1484 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 1489 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1485 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1490 | let output = p.expect_end_eventually()?; | 1486 | let output = p.expect_end_eventually()?; |
| @@ -1639,7 +1635,7 @@ async fn force_push_creates_proposal_revision() -> Result<()> { | |||
| 1639 | let mut p = | 1635 | let mut p = |
| 1640 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push", "--force"]); | 1636 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push", "--force"]); |
| 1641 | cli_expect_nostr_fetch(&mut p)?; | 1637 | cli_expect_nostr_fetch(&mut p)?; |
| 1642 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1638 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 1643 | p.expect("list: connecting...\r\n")?; | 1639 | p.expect("list: connecting...\r\n")?; |
| 1644 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1640 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1645 | let output = p.expect_end_eventually()?; | 1641 | let output = p.expect_end_eventually()?; |
| @@ -1784,14 +1780,12 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> { | |||
| 1784 | std::fs::write(git_repo.dir.join("new2.md"), "some content")?; | 1780 | std::fs::write(git_repo.dir.join("new2.md"), "some content")?; |
| 1785 | git_repo.stage_and_commit("new2.md")?; | 1781 | git_repo.stage_and_commit("new2.md")?; |
| 1786 | 1782 | ||
| 1787 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, [ | 1783 | let mut p = CliTester::new_git_with_remote_helper_from_dir( |
| 1788 | "push", | 1784 | &git_repo.dir, |
| 1789 | "-u", | 1785 | ["push", "-u", "origin", branch_name], |
| 1790 | "origin", | 1786 | ); |
| 1791 | branch_name, | ||
| 1792 | ]); | ||
| 1793 | cli_expect_nostr_fetch(&mut p)?; | 1787 | cli_expect_nostr_fetch(&mut p)?; |
| 1794 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1788 | p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; |
| 1795 | p.expect("list: connecting...\r\n\r\r\r")?; | 1789 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 1796 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1790 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1797 | let output = p.expect_end_eventually()?; | 1791 | let output = p.expect_end_eventually()?; |