diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-24 14:15:04 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-24 14:15:04 +0000 |
| commit | 7f71a2e75a66bcacad9057f5e339e511e689b828 (patch) | |
| tree | b1bc6e9d2df28f9b740cde37f836c76bc1bb1c8e /grasp-audit/src/bin | |
| parent | ef279a881fc1694fe2d868a32224874eb50cd358 (diff) | |
fix grasp-audit test isolation to prevent cross-spec relay state corruption
Add Purgatory-prefixed fixture variants (PurgatoryValidRepoSent,
PurgatoryOwnerStateDataPushed) that create independent repos never
shared with the main fixture chain. Purgatory tests that mutate relay
state (replacement announcements, new state events, deletions) now use
these isolated fixtures so they cannot corrupt the repo that
push-authorization tests depend on.
Run purgatory tests before push-auth in the full suite, since push-auth
sends new replaceable state events (kind 30618) for the shared repo_id
that would displace the original served state event.
Diffstat (limited to 'grasp-audit/src/bin')
| -rw-r--r-- | grasp-audit/src/bin/grasp-audit.rs | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/grasp-audit/src/bin/grasp-audit.rs b/grasp-audit/src/bin/grasp-audit.rs index b3fa0db..d192f04 100644 --- a/grasp-audit/src/bin/grasp-audit.rs +++ b/grasp-audit/src/bin/grasp-audit.rs | |||
| @@ -144,51 +144,56 @@ async fn main() -> Result<()> { | |||
| 144 | println!("Running all tests...\n"); | 144 | println!("Running all tests...\n"); |
| 145 | let mut all_results = AuditResult::new("All GRASP-01 Tests"); | 145 | let mut all_results = AuditResult::new("All GRASP-01 Tests"); |
| 146 | 146 | ||
| 147 | // Repository creation tests | 147 | // NIP-01 smoke tests (stateless - no shared fixture dependencies) |
| 148 | println!(" → NIP-01 smoke tests..."); | ||
| 149 | let nip01_results = specs::Nip01SmokeTests::run_all(&client).await; | ||
| 150 | all_results.merge(nip01_results); | ||
| 151 | |||
| 152 | // NIP-11 document tests (stateless) | ||
| 153 | println!(" → NIP-11 document tests..."); | ||
| 154 | let nip11_results = specs::Nip11DocumentTests::run_all(&client).await; | ||
| 155 | all_results.merge(nip11_results); | ||
| 156 | |||
| 157 | // CORS tests (stateless HTTP checks) | ||
| 158 | println!(" → CORS tests..."); | ||
| 159 | let cors_results = specs::CorsTests::run_all(&client, &relay_domain).await; | ||
| 160 | all_results.merge(cors_results); | ||
| 161 | |||
| 162 | // Repository creation tests (uses ValidRepoSent only - no state events) | ||
| 148 | println!(" → Repository creation tests..."); | 163 | println!(" → Repository creation tests..."); |
| 149 | let repo_results = specs::RepositoryCreationTests::run_all(&client, &relay_domain).await; | 164 | let repo_results = specs::RepositoryCreationTests::run_all(&client, &relay_domain).await; |
| 150 | all_results.merge(repo_results); | 165 | all_results.merge(repo_results); |
| 151 | 166 | ||
| 152 | // Git clone tests | 167 | // Git clone tests (uses ValidRepoSent only - no state events) |
| 153 | println!(" → Git clone tests..."); | 168 | println!(" → Git clone tests..."); |
| 154 | let clone_results = specs::GitCloneTests::run_all(&client, &relay_domain).await; | 169 | let clone_results = specs::GitCloneTests::run_all(&client, &relay_domain).await; |
| 155 | all_results.merge(clone_results); | 170 | all_results.merge(clone_results); |
| 156 | 171 | ||
| 157 | // Git filter capability tests | 172 | // Git filter capability tests (uses ValidRepoSent only - no state events) |
| 158 | println!(" → Git filter capability tests..."); | 173 | println!(" → Git filter capability tests..."); |
| 159 | let filter_results = specs::GitFilterTests::run_all(&client, &relay_domain).await; | 174 | let filter_results = specs::GitFilterTests::run_all(&client, &relay_domain).await; |
| 160 | all_results.merge(filter_results); | 175 | all_results.merge(filter_results); |
| 161 | 176 | ||
| 162 | // Push authorization tests | 177 | // Event acceptance policy tests (uses ValidRepoServed - no extra state events) |
| 163 | println!(" → Push authorization tests..."); | ||
| 164 | let push_results = specs::PushAuthorizationTests::run_all(&client, &relay_domain).await; | ||
| 165 | all_results.merge(push_results); | ||
| 166 | |||
| 167 | // Event acceptance policy tests | ||
| 168 | println!(" → Event acceptance policy tests..."); | 178 | println!(" → Event acceptance policy tests..."); |
| 169 | let event_results = specs::EventAcceptancePolicyTests::run_all(&client).await; | 179 | let event_results = specs::EventAcceptancePolicyTests::run_all(&client).await; |
| 170 | all_results.merge(event_results); | 180 | all_results.merge(event_results); |
| 171 | 181 | ||
| 172 | // NIP-01 smoke tests | 182 | // Purgatory tests MUST run before push-auth. |
| 173 | println!(" → NIP-01 smoke tests..."); | 183 | // Push-auth sends new replaceable state events (kind 30618) for the same |
| 174 | let nip01_results = specs::Nip01SmokeTests::run_all(&client).await; | 184 | // repo_id as OwnerStateDataPushed (e.g. test_head_set_after_git_push_with_required_oids |
| 175 | all_results.merge(nip01_results); | 185 | // sends a develop1 state event that displaces the original). If purgatory ran |
| 176 | 186 | // after push-auth, is_event_on_relay(original_id) would return false because | |
| 177 | // NIP-11 document tests | 187 | // the original state event has been replaced on the relay. |
| 178 | println!(" → NIP-11 document tests..."); | ||
| 179 | let nip11_results = specs::Nip11DocumentTests::run_all(&client).await; | ||
| 180 | all_results.merge(nip11_results); | ||
| 181 | |||
| 182 | // CORS tests | ||
| 183 | println!(" → CORS tests..."); | ||
| 184 | let cors_results = specs::CorsTests::run_all(&client, &relay_domain).await; | ||
| 185 | all_results.merge(cors_results); | ||
| 186 | |||
| 187 | // Purgatory tests | ||
| 188 | println!(" → Purgatory tests..."); | 188 | println!(" → Purgatory tests..."); |
| 189 | let purgatory_results = specs::PurgatoryTests::run_all(&client).await; | 189 | let purgatory_results = specs::PurgatoryTests::run_all(&client).await; |
| 190 | all_results.merge(purgatory_results); | 190 | all_results.merge(purgatory_results); |
| 191 | 191 | ||
| 192 | // Push authorization tests (mutates shared state - must run last among git specs) | ||
| 193 | println!(" → Push authorization tests..."); | ||
| 194 | let push_results = specs::PushAuthorizationTests::run_all(&client, &relay_domain).await; | ||
| 195 | all_results.merge(push_results); | ||
| 196 | |||
| 192 | println!(); | 197 | println!(); |
| 193 | all_results | 198 | all_results |
| 194 | } | 199 | } |