upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2026-01-02test: fix issue kind numberDanConwayDev
2025-12-31test: remove local sync on state git data received testDanConwayDev
because the current fixtures don't actually having mutliple owner_repos. they would need 2 announcements that both listed the service and a maintainer relationship. We could do this in grasp-audit but it would require an extra announcement from a different maintainer sent eariler on in the dependancy chain.
2025-12-31purgatory: when state data recieved sync across repositoiesDanConwayDev
2025-12-23test: add purgatory to PR push testDanConwayDev
commented out so it currently passes
2025-12-23test: add stub for purgatory maintainer repo sync testDanConwayDev
2025-12-23test: remove test covered elsewhereDanConwayDev
as new feature purgatory is going to complicate having this test here. it will be better to have this covered in push authorisation
2025-12-22chore: cargo fmt and clippyDanConwayDev
2025-12-19test: sync add test for pagination of historic that requires manually ↵DanConwayDev
setting lower thresholds
2025-12-19Simplify sync metrics to track only newly saved eventsDanConwayDev
Replace broken event counting that occurred before duplicate/policy checks with accurate tracking of events that are new, accepted, and saved. Changes: - Added ProcessResult enum to track event processing outcomes - Modified process_event_static() to return ProcessResult - Replaced events_total (with source labels) with events_synced_total - Removed gap_events_total and event_source module - Removed eose_received flag (EOSE is per-subscription, not suitable) - Updated all tests to use new simplified API The new ngit_sync_events_synced_total metric only counts events that: 1. Are new (not duplicates) 2. Pass write policy validation 3. Are successfully saved to database All 165 tests pass (124 lib + 41 integration)
2025-12-19test: fix test_multi_source_aggregate_countsDanConwayDev
2025-12-19test: fix test_live_sync_event_countDanConwayDev
2025-12-19test: clear names for sync testsDanConwayDev
2025-12-18docs: document sync test refactoring findings and patternsDanConwayDev
- Add comprehensive test pattern guidance to tests/sync/mod.rs - Explain when to use run_sync_test() vs manual setup - Document helper scope and architectural limitations Key findings: - historic_sync.rs: 4 tests refactored, 143 lines removed (50% reduction) - live_sync/discovery/tag_variations: Manual setup required due to architectural incompatibilities (timing, multi-relay, assertions) - Helper works for batch historic verification, not real-time scenarios Detailed summary available in work/sync-test-refactor-summary.md
2025-12-18refactor: migrate historic_sync.rs tests to use run_sync_test() helperDanConwayDev
- Refactored all 4 tests in historic_sync.rs to use run_sync_test() - Tests maintain same logic and assertions, only setup simplified - Moved run_sync_test() and SyncTestResult outside #[cfg(test)] module - Updated validation to allow empty event slices (for announcement-only tests) - All 4 historic_sync tests passing (test_bootstrap_syncs_existing_layer2_events, test_relay_replays_events_after_restart, test_announcement_not_listing_relay_is_not_synced, test_history_sync_without_negentropy) - Result: 39/40 tests passing (1 more than Phase 1 baseline of 38/40)
2025-12-18refactor: rename bootstrap.rs to historic_sync.rs for clarityDanConwayDev
2025-12-18test: add unified run_sync_test() helper infrastructureDanConwayDev
Add SyncTestResult struct and run_sync_test() helper function to sync_helpers.rs for unified test setup. The helper automatically determines sync mode (historic vs live) based on which event slice has content. Features: - SyncTestResult: holds test fixtures (relays, keys, repo_coord) - run_sync_test(): unified setup for both historic and live sync tests - Panic guards for invalid usage (both slices or neither) - Unit tests for panic conditions Test results: 40 tests total, 38 passing (same as baseline) - 2 pre-existing metric test failures (unchanged from baseline) - All new panic condition tests passing - No regressions introduced
2025-12-18sync: turn off negentropy and fix some testsDanConwayDev
2025-12-18sync: fix sync connectionDanConwayDev
2025-12-18sync removing dead codeDanConwayDev
2025-12-11fix: resolve all fmt and clippy warningsDanConwayDev
Main lib (src/): - Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration) - Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting) - Replace .or_insert_with(RelaySyncNeeds::default) with .or_default() - Replace manual div_ceil implementations with .div_ceil(100) Test code (tests/): - Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...)) - Remove needless borrows in fetch_metrics() calls - Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module grasp-audit: - Apply cargo fmt to fix formatting
2025-12-11sync: test sync works without negentropy and add disable option in syncDanConwayDev
2025-12-11test: nip77 smoke testDanConwayDev
2025-12-11docs(tests): replace catchup.rs test with documentationDanConwayDev
The catchup sync mechanism (reconnection with since filter) is implemented in src/sync/mod.rs handle_connect_or_reconnect(), but cannot be reliably integration tested with current infrastructure: - TestRelay uses in-memory database (events lost on stop) - No way to force WebSocket disconnection without stopping relay - Stopping syncing relay creates new instance (fresh sync, not catchup) Convert the skeleton test file to comprehensive documentation explaining: - How catchup sync works (since filter on reconnect) - The 15-minute quick reconnect window logic - Why integration testing is not feasible - Alternative approaches that could enable testing - Related tests that cover adjacent functionality
2025-12-11fix: sync metrics aggregate relay countsDanConwayDev
2025-12-11fix: classify sync events as startup/live based on EOSE, not relay typeDanConwayDev
Previously, events were classified as 'startup' or 'live' based on whether they came from a bootstrap relay (is_bootstrap flag). This meant ALL events from bootstrap relays were counted as 'startup', even events received after the initial sync completed. Now events are classified based on whether EOSE (End Of Stored Events) has been received for that connection: - Events BEFORE EOSE → 'startup' (historical events during initial sync) - Events AFTER EOSE → 'live' (new events via real-time subscription) This enables the test_live_sync_event_count test which validates that events received after sync connection is established are counted as live events. Also removed the #[ignore] attribute from test_live_sync_event_count since the metrics are now properly wired up.
2025-12-11fix: wire up relay disconnection detection for metricsDanConwayDev
- Add periodic health check in RelayConnection::run_event_loop that polls nostr-sdk's relay.is_connected() every second to detect dead connections - When event channel closes without explicit Closed/Shutdown, send DisconnectNotification to SyncManager (fixes case where TCP drops silently) - Enable test_relay_connected_status test which validates the ngit_sync_relay_connected metric correctly reflects connection state The issue was that when a remote relay stops abruptly, nostr-sdk's notification receiver blocks indefinitely waiting for data. TCP disconnect detection without keepalive can take minutes. The health check polls nostr-sdk's internal relay status which detects disconnection promptly.
2025-12-11fix: resolve duplicate SyncMetrics registration preventing metrics recordingDanConwayDev
Root cause: Both Metrics::new() and SyncManager::new() were trying to register SyncMetrics with the same Prometheus registry. The second registration failed silently, leaving SyncManager.metrics = None, so record_connection_attempt() calls were no-ops. Changes: - SyncManager::new() now accepts Option<SyncMetrics> instead of Option<&Registry> - main.rs passes already-registered sync metrics from Metrics to SyncManager - Simplified test_connection_failure_increments_counter assertion - Marked 3 tests as #[ignore] pending relay tracking metrics wiring Tests fixed: - test_connection_failure_increments_counter (now counts failures) - test_health_state_degrades_on_failure (now tracks health state) - test_live_sync_layer3_events (already working, confirmed) Tests ignored (future work): - test_live_sync_event_count - test_multi_source_aggregate_counts - test_relay_connected_status
2025-12-11sync: add sync_base_backoff_secs config for better testingDanConwayDev
2025-12-11fix(sync): improve metrics recording and connection failure detectionDanConwayDev
Changes: - Fix connection attempt metrics: record success/failure based on actual connection result instead of pre-emptively recording failure - Add health tracker integration on connection failure: call record_failure() and record_health_state() in error path - Add connection verification in relay_connection.rs: wait 500ms after connect() then verify is_connected() to detect silent failures - Add configurable disconnect check interval via NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS env var - Update TestRelay with fast test settings: startup_delay=0, jitter=0, disconnect_check_interval=1s - Add debug output to metrics tests for investigation Note: Tests may still fail due to 5-second base backoff in health tracker. A follow-up task will add NGIT_SYNC_BASE_BACKOFF_SECS config parameter to allow faster test cycles. Related: metrics-wiring-plan.md Tasks 1 & 2
2025-12-11Phase 4: Add health state and multi-relay aggregate testsDanConwayDev
2025-12-11Phase 3: Delete useless tests, add 3 real metrics testsDanConwayDev
Deleted 12 existence-only tests that provided zero confidence: - test_sync_metrics_exposed - test_sync_metric_names_present - test_connection_metrics_on_success - test_event_sync_metrics - test_health_state_metrics - test_gap_event_tracking - test_connection_failure_metrics - test_failure_counter_increments - test_relay_count_metrics - test_event_source_labels_in_metrics - test_multi_relay_load - test_gap_events_tracked_separately Kept 5 valuable tests: - test_prometheus_format_valid - test_concurrent_metrics_requests - test_metric_values_are_numeric - test_startup_sync_event_count - test_metrics_availability_during_sync Added 3 real value-checking tests (currently ignored): - test_connection_failure_increments_counter - test_live_sync_event_count - test_relay_connected_status Test results: 6 passed, 0 failed, 3 ignored
2025-12-11Phase 2: Add first real metrics test (startup event count)DanConwayDev
2025-12-11Phase 1: Add ParsedMetrics and MetricsTestHarness infrastructureDanConwayDev
2025-12-11test: add additional sync metrics tests for better coverage (Phase 8)DanConwayDev
2025-12-11refactor: move metrics tests to tests/sync/ structure (Phase 7)DanConwayDev
2025-12-10fix: enable Layer 3 sync by adding root events to pending queueDanConwayDev
When root events (issues/patches) are received via self-subscription, handle_root_event() was only updating the repo_sync_index directly. This caused process_batch() to early-return when pending.is_empty(), so Layer 3 filters for comments/replies were never created. The fix adds root events to both: 1. repo_sync_index (for immediate availability) 2. pending queue (to trigger Layer 3 filter creation in next batch) Critical: The pending entry must include relays from repo_sync_index so derive_relay_targets() knows where to send Layer 3 subscriptions. The Layer 3 test now verifies that events sent BEFORE the subscription is established are still synced - proving subscriptions without 'since' correctly fetch historical events. Enabled 4 previously ignored Layer 3 tests: - test_live_sync_layer3_events - test_layer3_sync_with_lowercase_e_tag - test_layer3_sync_with_uppercase_e_tag - test_layer3_sync_with_q_tag
2025-12-10feat(sync): broadcast synced events to WebSocket subscribersDanConwayDev
Enable recursive relay discovery by broadcasting synced events to WebSocket subscribers via LocalRelay.notify_event(). This allows the SelfSubscriber to receive 30617 announcements synced from external relays and discover additional relay URLs to connect to. Changes: - Pass LocalRelay to SyncManager::new() from main.rs - Add local_relay field to SyncManager struct - Call notify_event() after saving synced events to database - Enable test_recursive_relay_discovery_syncs_announcement test The test verifies that when relay_a syncs announcement_x from bootstrap relay_b (which lists relay_c), relay_a discovers and connects to relay_c to sync announcement_y. Fixes recursive relay discovery from bootstrap sync.
2025-12-10test(sync): add wait_for_sync_connection helper for improved reliabilityDanConwayDev
2025-12-10test(sync): add 3-relay recursive discovery testDanConwayDev
2025-12-10test(sync): add rejection test for announcements without clone tagsDanConwayDev
2025-12-10refactor(tests): extract shared create_repo_announcement helperDanConwayDev
2025-12-10Phase 10: Remove obsolete proactive_sync_basic.rs test fileDanConwayDev
All tests from this file have been migrated to the new modular structure: - tests/sync/bootstrap.rs (Tests 1, 4) - tests/sync/discovery.rs (Tests 2, 3) - tests/sync/live_sync.rs (Tests 5, 6, 7) - tests/sync/tag_variations.rs (Tests 8a-c, 9a-c) - tests/sync/catchup.rs (Test 0) Verified: cargo test --test sync shows 19 passed, 5 ignored
2025-12-10Phase 8: Create catchup sync stub testDanConwayDev
2025-12-10Phase 7: Implement tag variation testsDanConwayDev
Add comprehensive tests for different Layer 2 and Layer 3 tag variations: Layer 2 tests (Tests 8a-c) - all pass: - test_layer2_sync_with_lowercase_a_tag (standard NIP-01) - test_layer2_sync_with_uppercase_a_tag (NIP-33) - test_layer2_sync_with_q_tag (NIP-18 quotes) Layer 3 tests (Tests 9a-c) - marked #[ignore]: - test_layer3_sync_with_lowercase_e_tag (NIP-01) - test_layer3_sync_with_uppercase_e_tag (NIP-22) - test_layer3_sync_with_q_tag (NIP-18) Layer 3 tests have full implementation but are ignored until Layer 3 sync is enabled in the relay.
2025-12-10Phase 6: Implement live sync testsDanConwayDev
2025-12-10Phase 5: Migrate bootstrap and discovery testsDanConwayDev
Create organized test structure for proactive sync: tests/common/sync_helpers.rs (from Phase 4): - TestClient with retry logic for connect/send - Event builders: build_layer2_issue_event, build_layer3_comment_event - Tag variants (a/A/q for Layer 2, e/E/q for Layer 3) - wait_for_event_on_relay() assertion helper - repo_coord() utility function - Unit tests for all builders tests/sync/mod.rs: - Module organization for sync tests - Documentation of test categories tests/sync.rs: - Main test harness including common and sync modules tests/sync/bootstrap.rs: - test_bootstrap_syncs_existing_layer2_events (Test 1) - test_relay_replays_events_after_restart (Test 4) tests/sync/discovery.rs: - test_discovers_layer3_via_layer2 (Test 2) - test_layer2_discovery_with_chain (Test 3 - simplified) All 14 tests pass: cargo test --test sync
2025-12-10sync: fix connection registration issueDanConwayDev
2025-12-10improve sync designDanConwayDev
2025-12-08delete old bad AI genreated testsDanConwayDev
2025-12-08tests: discover and sync from relay in annocunement published directlyDanConwayDev
2025-12-05remove stupid tests and methodsDanConwayDev
2025-12-05test: fix proactive sync basic testsDanConwayDev
2025-12-05rename sunc_bootstrap_relay_urlDanConwayDev
2025-12-05fix basic sync testsDanConwayDev
2025-12-04feat(sync): Phase 6 - observability and production readinessDanConwayDev
- Add SyncMetrics with full Prometheus integration - Track sync gaps via catchup events - Update Grafana dashboard with sync panels - Document all sync configuration options - Update design doc with implementation notes
2025-12-04feat(sync): Phase 5 - negentropy catchup (NIP-77)DanConwayDev
- Add NegentropyService for set reconciliation - Implement startup catchup with warm-up delay - Implement reconnect catchup (last 3 days) - Add daily catchup schedule with stagger
2025-12-04feat(sync): Phase 4 - dynamic subscriptionsDanConwayDev
- Add SubscriptionManager for per-connection tracking - Trigger subscription updates on new repo/PR events - Implement consolidation when filter count > 150
2025-12-04feat(sync): Phase 3 - resilience and health trackingDanConwayDev
- Add RelayHealthTracker with DashMap - Implement exponential backoff (5s -> 1h max) - Handle dead relays (24h failures -> daily retry) - Add startup jitter to prevent thundering herd - Add NGIT_SYNC_MAX_BACKOFF_SECS config
2025-12-04feat(sync): Phase 2 - multi-relay and complete filtersDanConwayDev
- Add relay discovery from stored announcements - Implement FilterService with three-layer strategy - Support multiple simultaneous relay connections - Filter batching for large tag sets
2025-12-04feat(sync): Phase 1 MVP - single relay proactive syncDanConwayDev
- Add src/sync/ module with SyncManager - Add NGIT_SYNC_RELAY_URL config option - Subscribe to kind 30617 on configured relay - Validate synced events through Nip34WritePolicy - Integration test with two TestRelay instances
2025-12-03feat: accept maintainer announcements without service listingDanConwayDev
2025-12-03remove depricated audit mode label ci / production ~> isolated / sharedDanConwayDev
2025-12-01add repo land page and 404 page per GRASP-01DanConwayDev
2025-12-01test placeholder: test_head_set_after_git_push_with_required_oidsDanConwayDev
2025-12-01test: test_head_set_after_state_event_with_existing_commitDanConwayDev
currently failing as branch isn't pushed (we should auto create this branch as we have the ref)
2025-12-01fix cargo clippy and fmt warningsDanConwayDev
2025-11-28test: added checks that refs/nostr/<event-id> match commit in PR / updateDanConwayDev
2025-11-28allow push to ref/nostr/<event-id>DanConwayDev
2025-11-28fix cargo testDanConwayDev
2025-11-28test: rationalise repository creation testsDanConwayDev
2025-11-28audit: stop checking git_data_directoryDanConwayDev
2025-11-28add git http advertisment allow-reachable-sha1-in-want and ↵DanConwayDev
allow-tip-sha1-in-want
2025-11-27fix(tests): update main project tests for grasp-audit API changesDanConwayDev
2025-11-26test: use fixtures in push testsDanConwayDev
2025-11-26fix: parsing maintainers from announcement eventDanConwayDev
2025-11-26feat: push authorization from state eventDanConwayDev
2025-11-26test: remove bad testDanConwayDev
we dont need to check the git files exist locally
2025-11-26add cors supportDanConwayDev
2025-11-21add http clone testsDanConwayDev
2025-11-21removed test that checked repository test cleanupDanConwayDev
2025-11-21add repository creationDanConwayDev
2025-11-21add nip11DanConwayDev
2025-11-20refactor: isolate each grasp-audit lib test with minimal boilerplateDanConwayDev
- Add isolated_test! macro pattern to nip34_announcements.rs and nip01_compliance.rs - Each test runs with its own fresh relay instance for complete isolation - Make all individual test functions public in grasp-audit library (nip01_smoke.rs, event_acceptance_policy.rs) - Eliminates 122 lines of boilerplate across integration tests - Tests: 15 GRASP-01 event acceptance policy tests + 6 NIP-01 smoke tests - Ensures tests don't interfere with each other, preventing flakiness
2025-11-20replace tests to use grasp-audit lib as much as possibleDanConwayDev
2025-11-19fix some clippy fmt warningsDanConwayDev
2025-11-19add landing page and nostr-relay-builder relay on same portDanConwayDev
2025-11-04fix: remove nix crate usage from test codeDanConwayDev
Replace nix::sys::signal usage with standard library process::kill(). This completes the removal of the unnecessary nix dev dependency. All tests passing: - NIP-01: 6 passed, 1 ignored - NIP-34: 12 passed, 1 ignored
2025-11-04test: migrate to TestRelay fixture pattern and add compliance docsDanConwayDev
- Remove unnecessary 'nix' dev dependency (Unix syscalls crate, not needed) - Migrate announcement tests to new TestRelay fixture pattern - Delete legacy test files (announcement_tests.rs, test_relay.sh) - Add comprehensive test documentation (docs/how-to/test-compliance.md) - Update README.md with new test commands - All 18 integration tests passing (NIP-01 + NIP-34) Benefits: - Automatic relay lifecycle management - No manual setup required - Pure Rust integration tests - Better developer experience - CI/CD ready
2025-11-04add announcement testsDanConwayDev