upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/specs/grasp01/git_clone.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-28 03:38:50 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-28 03:38:50 +0000
commitf41550ea1898be2ec6c4be205e4cad0085400313 (patch)
tree00cc474031bf81fe382c6276e52fd769b275cd3f /grasp-audit/src/specs/grasp01/git_clone.rs
parent3f74ababf338d65ac5e29e7eb5541ce416b7fe75 (diff)
audit: stop checking git_data_directory
Diffstat (limited to 'grasp-audit/src/specs/grasp01/git_clone.rs')
-rw-r--r--grasp-audit/src/specs/grasp01/git_clone.rs45
1 files changed, 5 insertions, 40 deletions
diff --git a/grasp-audit/src/specs/grasp01/git_clone.rs b/grasp-audit/src/specs/grasp01/git_clone.rs
index 4666a40..9ee6ed7 100644
--- a/grasp-audit/src/specs/grasp01/git_clone.rs
+++ b/grasp-audit/src/specs/grasp01/git_clone.rs
@@ -18,7 +18,6 @@
18use crate::{AuditClient, FixtureKind, TestContext, TestResult}; 18use crate::{AuditClient, FixtureKind, TestContext, TestResult};
19use nostr_sdk::prelude::*; 19use nostr_sdk::prelude::*;
20use std::fs; 20use std::fs;
21use std::path::Path;
22use std::process::Command; 21use std::process::Command;
23 22
24/// Test suite for Git clone operations 23/// Test suite for Git clone operations
@@ -28,14 +27,13 @@ impl GitCloneTests {
28 /// Run all Git clone tests 27 /// Run all Git clone tests
29 pub async fn run_all( 28 pub async fn run_all(
30 client: &AuditClient, 29 client: &AuditClient,
31 git_data_dir: &Path,
32 relay_domain: &str, 30 relay_domain: &str,
33 ) -> crate::AuditResult { 31 ) -> crate::AuditResult {
34 let mut results = crate::AuditResult::new("GRASP-01 Git Clone Tests"); 32 let mut results = crate::AuditResult::new("GRASP-01 Git Clone Tests");
35 33
36 results.add(Self::test_basic_git_clone(client, git_data_dir, relay_domain).await); 34 results.add(Self::test_basic_git_clone(client, relay_domain).await);
37 results.add(Self::test_clone_url_format(client, git_data_dir, relay_domain).await); 35 results.add(Self::test_clone_url_format(client, relay_domain).await);
38 results.add(Self::test_sha1_capabilities_advertised(client, git_data_dir, relay_domain).await); 36 results.add(Self::test_sha1_capabilities_advertised(client, relay_domain).await);
39 37
40 results 38 results
41 } 39 }
@@ -49,7 +47,6 @@ impl GitCloneTests {
49 /// 4. Verifies the clone succeeded 47 /// 4. Verifies the clone succeeded
50 pub async fn test_basic_git_clone( 48 pub async fn test_basic_git_clone(
51 client: &AuditClient, 49 client: &AuditClient,
52 git_data_dir: &Path,
53 relay_domain: &str, 50 relay_domain: &str,
54 ) -> TestResult { 51 ) -> TestResult {
55 let test_name = "test_basic_git_clone"; 52 let test_name = "test_basic_git_clone";
@@ -101,20 +98,6 @@ impl GitCloneTests {
101 } 98 }
102 }; 99 };
103 100
104 // Verify repository exists
105 let repo_path = git_data_dir.join(&npub).join(format!("{}.git", repo_id));
106 if !repo_path.exists() {
107 return TestResult::new(
108 test_name,
109 "GRASP-01",
110 "Repository must be cloneable via Git HTTP backend",
111 )
112 .fail(&format!(
113 "Repository not found at: {}",
114 repo_path.display()
115 ));
116 }
117
118 // Create a test clone directory using standard library 101 // Create a test clone directory using standard library
119 let temp_base = std::env::temp_dir(); 102 let temp_base = std::env::temp_dir();
120 let clone_dir_name = format!("grasp-test-clone-{}", uuid::Uuid::new_v4()); 103 let clone_dir_name = format!("grasp-test-clone-{}", uuid::Uuid::new_v4());
@@ -128,7 +111,7 @@ impl GitCloneTests {
128 111
129 // Attempt to clone the repository 112 // Attempt to clone the repository
130 let output = Command::new("git") 113 let output = Command::new("git")
131 .args(&["clone", &clone_url, clone_path.to_str().unwrap()]) 114 .args(["clone", &clone_url, clone_path.to_str().unwrap()])
132 .env("GIT_TERMINAL_PROMPT", "0") // Disable password prompts 115 .env("GIT_TERMINAL_PROMPT", "0") // Disable password prompts
133 .output(); 116 .output();
134 117
@@ -188,7 +171,6 @@ impl GitCloneTests {
188 /// 2. Invalid URLs are rejected properly 171 /// 2. Invalid URLs are rejected properly
189 pub async fn test_clone_url_format( 172 pub async fn test_clone_url_format(
190 client: &AuditClient, 173 client: &AuditClient,
191 _git_data_dir: &Path,
192 relay_domain: &str, 174 relay_domain: &str,
193 ) -> TestResult { 175 ) -> TestResult {
194 let test_name = "test_clone_url_format"; 176 let test_name = "test_clone_url_format";
@@ -254,7 +236,7 @@ impl GitCloneTests {
254 let invalid_url = format!("http://{}/invalid/path", relay_domain); 236 let invalid_url = format!("http://{}/invalid/path", relay_domain);
255 237
256 let output = Command::new("git") 238 let output = Command::new("git")
257 .args(&["clone", &invalid_url, clone_path.to_str().unwrap()]) 239 .args(["clone", &invalid_url, clone_path.to_str().unwrap()])
258 .env("GIT_TERMINAL_PROMPT", "0") 240 .env("GIT_TERMINAL_PROMPT", "0")
259 .output() 241 .output()
260 .unwrap(); 242 .unwrap();
@@ -291,7 +273,6 @@ impl GitCloneTests {
291 /// 2. Both allow-reachable-sha1-in-want and allow-tip-sha1-in-want are present 273 /// 2. Both allow-reachable-sha1-in-want and allow-tip-sha1-in-want are present
292 pub async fn test_sha1_capabilities_advertised( 274 pub async fn test_sha1_capabilities_advertised(
293 client: &AuditClient, 275 client: &AuditClient,
294 git_data_dir: &Path,
295 relay_domain: &str, 276 relay_domain: &str,
296 ) -> TestResult { 277 ) -> TestResult {
297 let test_name = "test_sha1_capabilities_advertised"; 278 let test_name = "test_sha1_capabilities_advertised";
@@ -343,20 +324,6 @@ impl GitCloneTests {
343 } 324 }
344 }; 325 };
345 326
346 // Verify repository exists
347 let repo_path = git_data_dir.join(&npub).join(format!("{}.git", repo_id));
348 if !repo_path.exists() {
349 return TestResult::new(
350 test_name,
351 "GRASP-01",
352 "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement",
353 )
354 .fail(&format!(
355 "Repository not found at: {}",
356 repo_path.display()
357 ));
358 }
359
360 // Build info/refs URL for git-upload-pack service 327 // Build info/refs URL for git-upload-pack service
361 let info_refs_url = format!( 328 let info_refs_url = format!(
362 "http://{}/{}/{}.git/info/refs?service=git-upload-pack", 329 "http://{}/{}/{}.git/info/refs?service=git-upload-pack",
@@ -435,8 +402,6 @@ impl GitCloneTests {
435 402
436#[cfg(test)] 403#[cfg(test)]
437mod tests { 404mod tests {
438
439
440 #[test] 405 #[test]
441 fn test_module_exists() { 406 fn test_module_exists() {
442 // Simple compilation test 407 // Simple compilation test