diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-03 14:50:22 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-03 15:18:23 +0000 |
| commit | 874a8abe1d076cfafd9baf919ec23d7d58200698 (patch) | |
| tree | dce0d0d36bddc496ff32f8555a8790d8dc7be7e4 /tests | |
| parent | 9fd4350c57bbe986ebf65bf3ea4c996572e81884 (diff) | |
| parent | 92a9a3bfe0bc522e8ae411991a366a3a6310d525 (diff) | |
Merge relay.ngit.dev migration: bug fixes and migration tooling
This merge includes critical bug fixes and comprehensive migration tooling
developed during the relay.ngit.dev migration effort.
Bug Fixes:
- Fix git protocol error handling to return HTTP 200 with ERR pkt-line
- Fix naughty list false positives and DNS failure identification
- Fix database query filters in load_existing_events (remove .since())
- Fix OID fetch tracking to distinguish 0 OIDs from successful fetches
- Fix purgatory event source tracking for filtered expiry logging
- Implement OID retry logic for 'not our ref' errors
Migration Tools & Documentation:
- Complete 5-phase migration analysis pipeline with orchestration script
- Phase 1: Event fetching from source relay
- Phase 2: Git sync verification
- Phase 3: Categorization and relay comparison
- Phase 4: Log extraction (parse failures, purgatory expiry)
- Phase 5: Action classification for migration decisions
- Comprehensive migration guide with lessons learned
- Troubleshooting guide for permission and corruption issues
Configuration:
- Add NGIT_LOG_LEVEL configuration option
- Update git throttle limits to 60/minute
- Improve logging throughout for better observability
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/purgatory_persistence.rs | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/tests/purgatory_persistence.rs b/tests/purgatory_persistence.rs index fe37c33..4dc5e94 100644 --- a/tests/purgatory_persistence.rs +++ b/tests/purgatory_persistence.rs | |||
| @@ -94,11 +94,13 @@ async fn test_full_purgatory_save_restore_cycle() { | |||
| 94 | state_event1.clone(), | 94 | state_event1.clone(), |
| 95 | "repo1".to_string(), | 95 | "repo1".to_string(), |
| 96 | keys1.public_key(), | 96 | keys1.public_key(), |
| 97 | false, | ||
| 97 | ); | 98 | ); |
| 98 | purgatory.add_state( | 99 | purgatory.add_state( |
| 99 | state_event2.clone(), | 100 | state_event2.clone(), |
| 100 | "repo2".to_string(), | 101 | "repo2".to_string(), |
| 101 | keys2.public_key(), | 102 | keys2.public_key(), |
| 103 | false, | ||
| 102 | ); | 104 | ); |
| 103 | 105 | ||
| 104 | // Add PR events to purgatory | 106 | // Add PR events to purgatory |
| @@ -106,11 +108,13 @@ async fn test_full_purgatory_save_restore_cycle() { | |||
| 106 | pr_event1.clone(), | 108 | pr_event1.clone(), |
| 107 | pr_event1.id.to_hex(), | 109 | pr_event1.id.to_hex(), |
| 108 | "commit-abc".to_string(), | 110 | "commit-abc".to_string(), |
| 111 | false, | ||
| 109 | ); | 112 | ); |
| 110 | purgatory.add_pr( | 113 | purgatory.add_pr( |
| 111 | pr_event2.clone(), | 114 | pr_event2.clone(), |
| 112 | pr_event2.id.to_hex(), | 115 | pr_event2.id.to_hex(), |
| 113 | "commit-def".to_string(), | 116 | "commit-def".to_string(), |
| 117 | false, | ||
| 114 | ); | 118 | ); |
| 115 | 119 | ||
| 116 | // Add a PR placeholder (git-data-first scenario) | 120 | // Add a PR placeholder (git-data-first scenario) |
| @@ -262,7 +266,12 @@ async fn test_purgatory_downtime_adjustment() { | |||
| 262 | 266 | ||
| 263 | let state_event = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); | 267 | let state_event = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); |
| 264 | 268 | ||
| 265 | purgatory.add_state(state_event.clone(), "repo1".to_string(), keys.public_key()); | 269 | purgatory.add_state( |
| 270 | state_event.clone(), | ||
| 271 | "repo1".to_string(), | ||
| 272 | keys.public_key(), | ||
| 273 | false, | ||
| 274 | ); | ||
| 266 | 275 | ||
| 267 | // Save to disk | 276 | // Save to disk |
| 268 | purgatory.save_to_disk(&state_path).unwrap(); | 277 | purgatory.save_to_disk(&state_path).unwrap(); |
| @@ -340,7 +349,7 @@ async fn test_purgatory_file_cleanup_after_restore() { | |||
| 340 | 349 | ||
| 341 | let state_event = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); | 350 | let state_event = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); |
| 342 | 351 | ||
| 343 | purgatory.add_state(state_event, "repo1".to_string(), keys.public_key()); | 352 | purgatory.add_state(state_event, "repo1".to_string(), keys.public_key(), false); |
| 344 | 353 | ||
| 345 | // Save to disk | 354 | // Save to disk |
| 346 | purgatory.save_to_disk(&state_path).unwrap(); | 355 | purgatory.save_to_disk(&state_path).unwrap(); |
| @@ -408,7 +417,7 @@ async fn test_purgatory_restore_missing_file() { | |||
| 408 | // Should be able to add events normally | 417 | // Should be able to add events normally |
| 409 | let keys = Keys::generate(); | 418 | let keys = Keys::generate(); |
| 410 | let event = create_test_event(&keys, "test").await; | 419 | let event = create_test_event(&keys, "test").await; |
| 411 | purgatory.add_state(event, "repo1".to_string(), keys.public_key()); | 420 | purgatory.add_state(event, "repo1".to_string(), keys.public_key(), false); |
| 412 | 421 | ||
| 413 | let (state_count, _) = purgatory.count(); | 422 | let (state_count, _) = purgatory.count(); |
| 414 | assert_eq!(state_count, 1); | 423 | assert_eq!(state_count, 1); |
| @@ -547,8 +556,18 @@ async fn test_purgatory_multiple_state_events_same_identifier() { | |||
| 547 | let event1 = create_state_event_with_refs(&keys1, "repo1", &[("main", "abc123")]).unwrap(); | 556 | let event1 = create_state_event_with_refs(&keys1, "repo1", &[("main", "abc123")]).unwrap(); |
| 548 | let event2 = create_state_event_with_refs(&keys2, "repo1", &[("main", "def456")]).unwrap(); | 557 | let event2 = create_state_event_with_refs(&keys2, "repo1", &[("main", "def456")]).unwrap(); |
| 549 | 558 | ||
| 550 | purgatory.add_state(event1.clone(), "repo1".to_string(), keys1.public_key()); | 559 | purgatory.add_state( |
| 551 | purgatory.add_state(event2.clone(), "repo1".to_string(), keys2.public_key()); | 560 | event1.clone(), |
| 561 | "repo1".to_string(), | ||
| 562 | keys1.public_key(), | ||
| 563 | false, | ||
| 564 | ); | ||
| 565 | purgatory.add_state( | ||
| 566 | event2.clone(), | ||
| 567 | "repo1".to_string(), | ||
| 568 | keys2.public_key(), | ||
| 569 | false, | ||
| 570 | ); | ||
| 552 | 571 | ||
| 553 | // Save and restore | 572 | // Save and restore |
| 554 | purgatory.save_to_disk(&state_path).unwrap(); | 573 | purgatory.save_to_disk(&state_path).unwrap(); |
| @@ -577,7 +596,12 @@ async fn test_purgatory_continues_working_after_restore() { | |||
| 577 | 596 | ||
| 578 | let event1 = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); | 597 | let event1 = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); |
| 579 | 598 | ||
| 580 | purgatory.add_state(event1.clone(), "repo1".to_string(), keys.public_key()); | 599 | purgatory.add_state( |
| 600 | event1.clone(), | ||
| 601 | "repo1".to_string(), | ||
| 602 | keys.public_key(), | ||
| 603 | false, | ||
| 604 | ); | ||
| 581 | 605 | ||
| 582 | // Save and restore | 606 | // Save and restore |
| 583 | purgatory.save_to_disk(&state_path).unwrap(); | 607 | purgatory.save_to_disk(&state_path).unwrap(); |
| @@ -588,7 +612,12 @@ async fn test_purgatory_continues_working_after_restore() { | |||
| 588 | // Add new events after restore | 612 | // Add new events after restore |
| 589 | let event2 = create_state_event_with_refs(&keys, "repo2", &[("main", "xyz789")]).unwrap(); | 613 | let event2 = create_state_event_with_refs(&keys, "repo2", &[("main", "xyz789")]).unwrap(); |
| 590 | 614 | ||
| 591 | purgatory2.add_state(event2.clone(), "repo2".to_string(), keys.public_key()); | 615 | purgatory2.add_state( |
| 616 | event2.clone(), | ||
| 617 | "repo2".to_string(), | ||
| 618 | keys.public_key(), | ||
| 619 | false, | ||
| 620 | ); | ||
| 592 | 621 | ||
| 593 | // Verify both old and new events work | 622 | // Verify both old and new events work |
| 594 | let (state_count, _) = purgatory2.count(); | 623 | let (state_count, _) = purgatory2.count(); |
| @@ -669,7 +698,7 @@ async fn test_purgatory_entries_expired_during_downtime() { | |||
| 669 | 698 | ||
| 670 | let event = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); | 699 | let event = create_state_event_with_refs(&keys, "repo1", &[("main", "abc123")]).unwrap(); |
| 671 | 700 | ||
| 672 | purgatory.add_state(event.clone(), "repo1".to_string(), keys.public_key()); | 701 | purgatory.add_state(event.clone(), "repo1".to_string(), keys.public_key(), false); |
| 673 | 702 | ||
| 674 | // Save to disk | 703 | // Save to disk |
| 675 | purgatory.save_to_disk(&state_path).unwrap(); | 704 | purgatory.save_to_disk(&state_path).unwrap(); |