diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 14:09:26 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 14:09:26 +0000 |
| commit | 5148479d76f0958e4a1989a6225a4690292b428f (patch) | |
| tree | 1af972d49be57c8097cb189f87d9c862ebb0b373 /grasp-audit/src/bin | |
| parent | 817ce37a5ee8d6279a44cf8cce3cc6a1e4bab576 (diff) | |
feat(grasp-audit): add filter capability compliance tests
Add comprehensive GRASP-01 compliance tests for uploadpack.allowFilter
capability to the grasp-audit test suite. These tests can be run against
ANY GRASP implementation (ngit-relay, ngit-grasp, or others) to verify
filter support.
New test module: grasp-audit/src/specs/grasp01/git_filter.rs
Tests added:
- test_filter_capability_advertised: Verifies filter appears in info/refs
- test_filtered_clone_succeeds: Tests git clone --filter=blob:none
- test_filtered_fetch_succeeds: Tests git fetch --filter=tree:0
Usage:
cd grasp-audit && nix develop -c bash test-ngit-relay.sh --mode test
cd grasp-audit && nix develop -c cargo run -- audit -r ws://localhost:8080 -s git-filter
Diffstat (limited to 'grasp-audit/src/bin')
| -rw-r--r-- | grasp-audit/src/bin/grasp-audit.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/grasp-audit/src/bin/grasp-audit.rs b/grasp-audit/src/bin/grasp-audit.rs index 08a92c7..99e3c35 100644 --- a/grasp-audit/src/bin/grasp-audit.rs +++ b/grasp-audit/src/bin/grasp-audit.rs | |||
| @@ -27,7 +27,7 @@ enum Commands { | |||
| 27 | #[arg(short, long, default_value = "shared")] | 27 | #[arg(short, long, default_value = "shared")] |
| 28 | mode: String, | 28 | mode: String, |
| 29 | 29 | ||
| 30 | /// Spec to test (nip01-smoke, nip11, event-acceptance, cors, git-clone, push-auth, repo-creation, all) | 30 | /// Spec to test (nip01-smoke, nip11, event-acceptance, cors, git-clone, git-filter, push-auth, repo-creation, all) |
| 31 | #[arg(short, long, default_value = "all")] | 31 | #[arg(short, long, default_value = "all")] |
| 32 | spec: String, | 32 | spec: String, |
| 33 | 33 | ||
| @@ -124,6 +124,10 @@ async fn main() -> Result<()> { | |||
| 124 | println!("Running Git clone tests...\n"); | 124 | println!("Running Git clone tests...\n"); |
| 125 | specs::GitCloneTests::run_all(&client, &relay_domain).await | 125 | specs::GitCloneTests::run_all(&client, &relay_domain).await |
| 126 | } | 126 | } |
| 127 | "git-filter" => { | ||
| 128 | println!("Running Git filter capability tests...\n"); | ||
| 129 | specs::GitFilterTests::run_all(&client, &relay_domain).await | ||
| 130 | } | ||
| 127 | "push-auth" => { | 131 | "push-auth" => { |
| 128 | println!("Running push authorization tests...\n"); | 132 | println!("Running push authorization tests...\n"); |
| 129 | specs::PushAuthorizationTests::run_all(&client, &relay_domain).await | 133 | specs::PushAuthorizationTests::run_all(&client, &relay_domain).await |
| @@ -146,6 +150,11 @@ async fn main() -> Result<()> { | |||
| 146 | let clone_results = specs::GitCloneTests::run_all(&client, &relay_domain).await; | 150 | let clone_results = specs::GitCloneTests::run_all(&client, &relay_domain).await; |
| 147 | all_results.merge(clone_results); | 151 | all_results.merge(clone_results); |
| 148 | 152 | ||
| 153 | // Git filter capability tests | ||
| 154 | println!(" → Git filter capability tests..."); | ||
| 155 | let filter_results = specs::GitFilterTests::run_all(&client, &relay_domain).await; | ||
| 156 | all_results.merge(filter_results); | ||
| 157 | |||
| 149 | // Push authorization tests | 158 | // Push authorization tests |
| 150 | println!(" → Push authorization tests..."); | 159 | println!(" → Push authorization tests..."); |
| 151 | let push_results = specs::PushAuthorizationTests::run_all(&client, &relay_domain).await; | 160 | let push_results = specs::PushAuthorizationTests::run_all(&client, &relay_domain).await; |
| @@ -176,7 +185,7 @@ async fn main() -> Result<()> { | |||
| 176 | } | 185 | } |
| 177 | _ => { | 186 | _ => { |
| 178 | return Err(anyhow!( | 187 | return Err(anyhow!( |
| 179 | "Unknown spec: {}. Use 'nip01-smoke', 'nip11', 'event-acceptance', 'cors', 'git-clone', 'push-auth', 'repo-creation', or 'all'", | 188 | "Unknown spec: {}. Use 'nip01-smoke', 'nip11', 'event-acceptance', 'cors', 'git-clone', 'git-filter', 'push-auth', 'repo-creation', or 'all'", |
| 180 | spec | 189 | spec |
| 181 | )) | 190 | )) |
| 182 | } | 191 | } |