diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 21:33:14 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 21:33:14 +0000 |
| commit | 62a3855cb96616caf704a0f112fb2ade99fb8b45 (patch) | |
| tree | 0b5669ead82534bf624a5beab552dcbf805e84d9 /grasp-audit | |
| parent | 53a11dcfaeac6b3d4f631f1d22d095469a0e3690 (diff) | |
audit: fix shared test_reject_repo_announcement_missing_relays_tag test
Diffstat (limited to 'grasp-audit')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/event_acceptance_policy.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs index 89220ea..6474399 100644 --- a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs +++ b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs | |||
| @@ -424,29 +424,31 @@ impl EventAcceptancePolicyTests { | |||
| 424 | "Accept valid state announcements after repo announcement accepted", | 424 | "Accept valid state announcements after repo announcement accepted", |
| 425 | ) | 425 | ) |
| 426 | .run(|| async { | 426 | .run(|| async { |
| 427 | // NEW: Create TestContext for mode-aware fixture management | 427 | // Create TestContext for mode-aware fixture management |
| 428 | let ctx = TestContext::new(client); | 428 | let ctx = TestContext::new(client); |
| 429 | 429 | ||
| 430 | // NEW: Request repository fixture - behavior depends on mode | 430 | // Use OwnerStateDataPushed which handles the complete flow: |
| 431 | // CI mode: Creates fresh repo for this test | 431 | // 1. Creates repo announcement |
| 432 | // Production mode: Returns cached repo if available | 432 | // 2. Pushes git data with the deterministic commit |
| 433 | let repo_event = ctx.get_fixture(FixtureKind::RepoState).await.map_err(|e| { | 433 | // 3. Sends the state announcement |
| 434 | // This ensures the state event references a commit that actually exists | ||
| 435 | let state_event = ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await.map_err(|e| { | ||
| 434 | format!( | 436 | format!( |
| 435 | "Test setup failed: could not get repository state fixture: {}", | 437 | "Test setup failed: could not get repository state fixture: {}", |
| 436 | e | 438 | e |
| 437 | ) | 439 | ) |
| 438 | })?; | 440 | })?; |
| 439 | 441 | ||
| 440 | // Extract repo_id from the repository announcement | 442 | // Extract repo_id from the state event |
| 441 | let repo_id = repo_event | 443 | let repo_id = state_event |
| 442 | .tags | 444 | .tags |
| 443 | .iter() | 445 | .iter() |
| 444 | .find(|t| t.kind() == TagKind::d()) | 446 | .find(|t| t.kind() == TagKind::d()) |
| 445 | .and_then(|t| t.content()) | 447 | .and_then(|t| t.content()) |
| 446 | .ok_or("Missing d tag in repository announcement")? | 448 | .ok_or("Missing d tag in state announcement")? |
| 447 | .to_string(); | 449 | .to_string(); |
| 448 | 450 | ||
| 449 | let event_id = repo_event.id; | 451 | let event_id = state_event.id; |
| 450 | 452 | ||
| 451 | // Query back to verify it was accepted and stored | 453 | // Query back to verify it was accepted and stored |
| 452 | let filter = Filter::new() | 454 | let filter = Filter::new() |