upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-23 10:46:26 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-23 13:36:53 +0100
commit2cdbb8c7ac6c98af6e36c4458c08bef2299794e1 (patch)
treefcf7c56d2f5eda0776643f8a52090965f1de06a8 /tests
parent51358320c50afece31fc25945a09e3d7aac8f39c (diff)
fix(remote): add resilience to `prs`
make poorly formatted patches fail silently. we stop trusting that the `commit` tag in the latest patch can be produced by apply the patches. to achieve this we must recreate the commit during the list command, which require fetching the parent oids. support patches without optional `commit` and `parent-commit` tags.
Diffstat (limited to 'tests')
-rw-r--r--tests/git_remote_nostr/fetch.rs4
-rw-r--r--tests/git_remote_nostr/list.rs8
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/git_remote_nostr/fetch.rs b/tests/git_remote_nostr/fetch.rs
index 26d0b5b..17fd6d4 100644
--- a/tests/git_remote_nostr/fetch.rs
+++ b/tests/git_remote_nostr/fetch.rs
@@ -140,8 +140,7 @@ mod when_first_git_server_fails_ {
140#[tokio::test] 140#[tokio::test]
141#[serial] 141#[serial]
142async fn creates_commits_from_open_proposal_with_no_warnings_printed() -> Result<()> { 142async fn creates_commits_from_open_proposal_with_no_warnings_printed() -> Result<()> {
143 let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; 143 let (events, _) = prep_source_repo_and_events_including_proposals().await?;
144 let source_path = source_git_repo.dir.to_str().unwrap().to_string();
145 144
146 let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( 145 let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = (
147 Relay::new(8051, None, None), 146 Relay::new(8051, None, None),
@@ -166,7 +165,6 @@ async fn creates_commits_from_open_proposal_with_no_warnings_printed() -> Result
166 let mut p = cli_tester_after_fetch(&git_repo)?; 165 let mut p = cli_tester_after_fetch(&git_repo)?;
167 p.send_line(format!("fetch {proposal_tip} refs/heads/{branch_name}").as_str())?; 166 p.send_line(format!("fetch {proposal_tip} refs/heads/{branch_name}").as_str())?;
168 p.send_line("")?; 167 p.send_line("")?;
169 p.expect(format!("fetching {source_path} over filesystem...\r\n").as_str())?;
170 // expect no errors 168 // expect no errors
171 p.expect_after_whitespace("\r\n")?; 169 p.expect_after_whitespace("\r\n")?;
172 p.exit()?; 170 p.exit()?;
diff --git a/tests/git_remote_nostr/list.rs b/tests/git_remote_nostr/list.rs
index d173cc7..37cff30 100644
--- a/tests/git_remote_nostr/list.rs
+++ b/tests/git_remote_nostr/list.rs
@@ -52,6 +52,10 @@ mod without_state_announcement {
52 assert_eq!( 52 assert_eq!(
53 res.split("\r\n") 53 res.split("\r\n")
54 .map(|e| e.to_string()) 54 .map(|e| e.to_string())
55 .filter(|s| !s.contains("remote: ")
56 && !s.contains("Receiving objects")
57 && !s.contains("Resolving deltas")
58 && !s.contains("fetching /"))
55 .collect::<HashSet<String>>(), 59 .collect::<HashSet<String>>(),
56 HashSet::from([ 60 HashSet::from([
57 "@refs/heads/main HEAD".to_string(), 61 "@refs/heads/main HEAD".to_string(),
@@ -220,6 +224,10 @@ mod with_state_announcement {
220 assert_eq!( 224 assert_eq!(
221 res.split("\r\n") 225 res.split("\r\n")
222 .map(|e| e.to_string()) 226 .map(|e| e.to_string())
227 .filter(|s| !s.contains("remote: ")
228 && !s.contains("Receiving objects")
229 && !s.contains("Resolving deltas")
230 && !s.contains("fetching /"))
223 .collect::<HashSet<String>>(), 231 .collect::<HashSet<String>>(),
224 HashSet::from([ 232 HashSet::from([
225 "@refs/heads/main HEAD".to_string(), 233 "@refs/heads/main HEAD".to_string(),