diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-26 03:57:44 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-26 03:57:44 +0000 |
| commit | a005132ab806b7177d4eb3e3306914841704ffec (patch) | |
| tree | 9be12935f6330410df54be55c6d6895c6f2719ee /grasp-audit/src | |
| parent | 963b2971ec2f43b1c2f669a969c294fc1d291d3b (diff) | |
test: remove bad test
we dont need to check the git files exist locally
Diffstat (limited to 'grasp-audit/src')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/git_clone.rs | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/grasp-audit/src/specs/grasp01/git_clone.rs b/grasp-audit/src/specs/grasp01/git_clone.rs index cad17d2..f85f94a 100644 --- a/grasp-audit/src/specs/grasp01/git_clone.rs +++ b/grasp-audit/src/specs/grasp01/git_clone.rs | |||
| @@ -165,132 +165,6 @@ impl GitCloneTests { | |||
| 165 | .pass() | 165 | .pass() |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /// Test that cloned repository has correct structure | ||
| 169 | /// | ||
| 170 | /// This test verifies: | ||
| 171 | /// 1. Clone creates a valid Git repository | ||
| 172 | /// 2. Repository has proper Git structure (.git/config, .git/HEAD, etc.) | ||
| 173 | /// 3. Repository is properly initialized | ||
| 174 | pub async fn test_cloned_repo_structure( | ||
| 175 | client: &AuditClient, | ||
| 176 | _git_data_dir: &Path, | ||
| 177 | relay_domain: &str, | ||
| 178 | ) -> TestResult { | ||
| 179 | let test_name = "test_cloned_repo_structure"; | ||
| 180 | let ctx = TestContext::new(client); | ||
| 181 | |||
| 182 | // Create repository announcement | ||
| 183 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | ||
| 184 | Ok(r) => r, | ||
| 185 | Err(e) => { | ||
| 186 | return TestResult::new( | ||
| 187 | test_name, | ||
| 188 | "GRASP-01", | ||
| 189 | "Cloned repository must have correct structure", | ||
| 190 | ) | ||
| 191 | .fail(&format!("Failed to create repo fixture: {}", e)) | ||
| 192 | } | ||
| 193 | }; | ||
| 194 | |||
| 195 | // Wait for repository creation | ||
| 196 | tokio::time::sleep(std::time::Duration::from_millis(200)).await; | ||
| 197 | |||
| 198 | // Extract repo identifier and npub | ||
| 199 | let repo_id = repo | ||
| 200 | .tags | ||
| 201 | .iter() | ||
| 202 | .find(|t| t.kind() == TagKind::d()) | ||
| 203 | .and_then(|t| t.content()) | ||
| 204 | .ok_or("Missing d tag") | ||
| 205 | .unwrap() | ||
| 206 | .to_string(); | ||
| 207 | |||
| 208 | let npub = repo.pubkey.to_bech32().unwrap(); | ||
| 209 | |||
| 210 | // Create temp clone directory using standard library | ||
| 211 | let temp_base = std::env::temp_dir(); | ||
| 212 | let clone_dir_name = format!("grasp-test-clone-struct-{}", uuid::Uuid::new_v4()); | ||
| 213 | let clone_path = temp_base.join(&clone_dir_name); | ||
| 214 | |||
| 215 | // Ensure clean state | ||
| 216 | let _ = fs::remove_dir_all(&clone_path); | ||
| 217 | |||
| 218 | // Cleanup helper | ||
| 219 | let cleanup = || { | ||
| 220 | let _ = fs::remove_dir_all(&clone_path); | ||
| 221 | }; | ||
| 222 | |||
| 223 | // Clone the repository | ||
| 224 | let clone_url = format!("http://{}/{}/{}.git", relay_domain, npub, repo_id); | ||
| 225 | let output = Command::new("git") | ||
| 226 | .args(&["clone", &clone_url, clone_path.to_str().unwrap()]) | ||
| 227 | .env("GIT_TERMINAL_PROMPT", "0") | ||
| 228 | .output() | ||
| 229 | .unwrap(); | ||
| 230 | |||
| 231 | if !output.status.success() { | ||
| 232 | cleanup(); | ||
| 233 | let stderr = String::from_utf8_lossy(&output.stderr); | ||
| 234 | return TestResult::new( | ||
| 235 | test_name, | ||
| 236 | "GRASP-01", | ||
| 237 | "Cloned repository must have correct structure", | ||
| 238 | ) | ||
| 239 | .fail(&format!("Git clone failed: {}", stderr)); | ||
| 240 | } | ||
| 241 | |||
| 242 | // Verify Git repository structure | ||
| 243 | let git_dir = clone_path.join(".git"); | ||
| 244 | |||
| 245 | if !git_dir.join("config").is_file() { | ||
| 246 | cleanup(); | ||
| 247 | return TestResult::new( | ||
| 248 | test_name, | ||
| 249 | "GRASP-01", | ||
| 250 | "Cloned repository must have correct structure", | ||
| 251 | ) | ||
| 252 | .fail("Missing .git/config file"); | ||
| 253 | } | ||
| 254 | |||
| 255 | if !git_dir.join("HEAD").is_file() { | ||
| 256 | cleanup(); | ||
| 257 | return TestResult::new( | ||
| 258 | test_name, | ||
| 259 | "GRASP-01", | ||
| 260 | "Cloned repository must have correct structure", | ||
| 261 | ) | ||
| 262 | .fail("Missing .git/HEAD file"); | ||
| 263 | } | ||
| 264 | |||
| 265 | if !git_dir.join("objects").is_dir() { | ||
| 266 | cleanup(); | ||
| 267 | return TestResult::new( | ||
| 268 | test_name, | ||
| 269 | "GRASP-01", | ||
| 270 | "Cloned repository must have correct structure", | ||
| 271 | ) | ||
| 272 | .fail("Missing .git/objects directory"); | ||
| 273 | } | ||
| 274 | |||
| 275 | if !git_dir.join("refs").is_dir() { | ||
| 276 | cleanup(); | ||
| 277 | return TestResult::new( | ||
| 278 | test_name, | ||
| 279 | "GRASP-01", | ||
| 280 | "Cloned repository must have correct structure", | ||
| 281 | ) | ||
| 282 | .fail("Missing .git/refs directory"); | ||
| 283 | } | ||
| 284 | |||
| 285 | cleanup(); | ||
| 286 | TestResult::new( | ||
| 287 | test_name, | ||
| 288 | "GRASP-01", | ||
| 289 | "Cloned repository must have correct structure", | ||
| 290 | ) | ||
| 291 | .pass() | ||
| 292 | } | ||
| 293 | |||
| 294 | /// Test clone URL format validation | 168 | /// Test clone URL format validation |
| 295 | /// | 169 | /// |
| 296 | /// This test verifies: | 170 | /// This test verifies: |