diff options
Diffstat (limited to 'docs/archive/2025-11-05-ngit-relay-testing-setup.md')
| -rw-r--r-- | docs/archive/2025-11-05-ngit-relay-testing-setup.md | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/docs/archive/2025-11-05-ngit-relay-testing-setup.md b/docs/archive/2025-11-05-ngit-relay-testing-setup.md new file mode 100644 index 0000000..7b4bd72 --- /dev/null +++ b/docs/archive/2025-11-05-ngit-relay-testing-setup.md | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | # ngit-relay Testing Setup - COMPLETE | ||
| 2 | |||
| 3 | **Date:** November 5, 2025 | ||
| 4 | **Status:** ✅ COMPLETE | ||
| 5 | **Purpose:** Document how to test grasp-audit against ngit-relay reference implementation | ||
| 6 | |||
| 7 | --- | ||
| 8 | |||
| 9 | ## ✅ What Was Done | ||
| 10 | |||
| 11 | ### 1. Updated grasp-audit/README.md | ||
| 12 | |||
| 13 | Added comprehensive section "Integration Tests Against ngit-relay" with: | ||
| 14 | |||
| 15 | - **Step-by-step manual instructions** for running tests | ||
| 16 | - **Environment variable explanations** (all required vars documented) | ||
| 17 | - **Port mapping details** (both WebSocket and HTTP on 8081) | ||
| 18 | - **Clean state strategy** (fresh /tmp directories for each run) | ||
| 19 | - **Cleanup procedures** (stop container, remove test data) | ||
| 20 | |||
| 21 | ### 2. Created test-ngit-relay.sh Script | ||
| 22 | |||
| 23 | Automated test script at `grasp-audit/test-ngit-relay.sh` that: | ||
| 24 | |||
| 25 | - ✅ Creates fresh test directories in /tmp | ||
| 26 | - ✅ Starts ngit-relay Docker container with correct env vars | ||
| 27 | - ✅ Waits for relay to start (3 second delay) | ||
| 28 | - ✅ Runs integration tests (`cargo test --ignored`) | ||
| 29 | - ✅ Stops container | ||
| 30 | - ✅ Cleans up test data | ||
| 31 | - ✅ Executable permissions set (`chmod +x`) | ||
| 32 | - ✅ Syntax validated | ||
| 33 | |||
| 34 | --- | ||
| 35 | |||
| 36 | ## 🔑 Key Information | ||
| 37 | |||
| 38 | ### Docker Image | ||
| 39 | ``` | ||
| 40 | ghcr.io/danconwaydev/ngit-relay:latest | ||
| 41 | ``` | ||
| 42 | |||
| 43 | ### Required Environment Variables | ||
| 44 | ```bash | ||
| 45 | NGIT_DOMAIN=localhost # Domain name | ||
| 46 | NGIT_RELAY_NAME="ngit-relay test instance" | ||
| 47 | NGIT_RELAY_DESCRIPTION="Test instance for grasp-audit" | ||
| 48 | NGIT_OWNER_NPUB="npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr" | ||
| 49 | NGIT_PROACTIVE_SYNC_GIT=false # Disable for testing | ||
| 50 | NGIT_PROACTIVE_SYNC_BLOSSOM=false # Disable for testing | ||
| 51 | NGIT_PROACTIVE_SYNC_NOSTR=false # Disable for testing | ||
| 52 | NGIT_LOG_LEVEL=INFO # For debugging | ||
| 53 | ``` | ||
| 54 | |||
| 55 | ### Volume Mounts (Fresh for Each Run) | ||
| 56 | ```bash | ||
| 57 | /tmp/ngit-test/repos → /srv/ngit-relay/repos | ||
| 58 | /tmp/ngit-test/blossom → /srv/ngit-relay/blossom | ||
| 59 | /tmp/ngit-test/relay-db → /srv/ngit-relay/relay-db | ||
| 60 | /tmp/ngit-test/logs → /var/log/ngit-relay | ||
| 61 | ``` | ||
| 62 | |||
| 63 | ### Port Mapping | ||
| 64 | ``` | ||
| 65 | 8081:8081 # Both WebSocket (relay) and HTTP (git) on same port | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### Endpoints | ||
| 69 | - **WebSocket (Nostr relay):** `ws://localhost:8081/` | ||
| 70 | - **Git HTTP:** `http://localhost:8081/<npub>/<identifier>.git` | ||
| 71 | |||
| 72 | --- | ||
| 73 | |||
| 74 | ## 🎯 Usage | ||
| 75 | |||
| 76 | ### Option 1: Manual Commands | ||
| 77 | |||
| 78 | ```bash | ||
| 79 | cd grasp-audit | ||
| 80 | |||
| 81 | # 1. Create temp directories | ||
| 82 | mkdir -p /tmp/ngit-test/{repos,blossom,relay-db,logs} | ||
| 83 | |||
| 84 | # 2. Start relay | ||
| 85 | docker run --rm -d \ | ||
| 86 | --name ngit-relay-test \ | ||
| 87 | -p 8081:8081 \ | ||
| 88 | -e NGIT_DOMAIN=localhost \ | ||
| 89 | -e NGIT_RELAY_NAME="ngit-relay test instance" \ | ||
| 90 | -e NGIT_RELAY_DESCRIPTION="Test instance for grasp-audit" \ | ||
| 91 | -e NGIT_OWNER_NPUB="npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr" \ | ||
| 92 | -e NGIT_PROACTIVE_SYNC_GIT=false \ | ||
| 93 | -e NGIT_PROACTIVE_SYNC_BLOSSOM=false \ | ||
| 94 | -e NGIT_PROACTIVE_SYNC_NOSTR=false \ | ||
| 95 | -e NGIT_LOG_LEVEL=INFO \ | ||
| 96 | -v /tmp/ngit-test/repos:/srv/ngit-relay/repos \ | ||
| 97 | -v /tmp/ngit-test/blossom:/srv/ngit-relay/blossom \ | ||
| 98 | -v /tmp/ngit-test/relay-db:/srv/ngit-relay/relay-db \ | ||
| 99 | -v /tmp/ngit-test/logs:/var/log/ngit-relay \ | ||
| 100 | ghcr.io/danconwaydev/ngit-relay:latest | ||
| 101 | |||
| 102 | # 3. Wait for startup | ||
| 103 | sleep 3 | ||
| 104 | |||
| 105 | # 4. Run tests | ||
| 106 | cargo test --ignored | ||
| 107 | |||
| 108 | # 5. Cleanup | ||
| 109 | docker stop ngit-relay-test | ||
| 110 | rm -rf /tmp/ngit-test | ||
| 111 | ``` | ||
| 112 | |||
| 113 | ### Option 2: Quick Script | ||
| 114 | |||
| 115 | ```bash | ||
| 116 | cd grasp-audit | ||
| 117 | ./test-ngit-relay.sh | ||
| 118 | ``` | ||
| 119 | |||
| 120 | --- | ||
| 121 | |||
| 122 | ## 🧪 What Gets Tested | ||
| 123 | |||
| 124 | When you run `cargo test --ignored`, it runs integration tests that: | ||
| 125 | |||
| 126 | 1. **Connect to the relay** at `ws://localhost:8081/` | ||
| 127 | 2. **Verify NIP-01 compliance** (smoke tests) | ||
| 128 | 3. **Test GRASP-01 features** (when implemented) | ||
| 129 | 4. **Validate against reference implementation** behavior | ||
| 130 | |||
| 131 | --- | ||
| 132 | |||
| 133 | ## ✅ Benefits | ||
| 134 | |||
| 135 | ### Clean State Every Run | ||
| 136 | - Fresh directories in /tmp | ||
| 137 | - No pollution from previous tests | ||
| 138 | - Matches CI environment | ||
| 139 | |||
| 140 | ### Easy Debugging | ||
| 141 | - Manual commands for step-by-step debugging | ||
| 142 | - Automated script for quick validation | ||
| 143 | - Logs available in /tmp/ngit-test/logs | ||
| 144 | |||
| 145 | ### Reference Implementation Testing | ||
| 146 | - Tests against the actual GRASP reference (ngit-relay) | ||
| 147 | - Ensures compatibility with real-world implementation | ||
| 148 | - Validates our tests match expected behavior | ||
| 149 | |||
| 150 | --- | ||
| 151 | |||
| 152 | ## 📚 References | ||
| 153 | |||
| 154 | - **ngit-relay repo:** `../ngit-relay` | ||
| 155 | - **Docker image:** `ghcr.io/danconwaydev/ngit-relay:latest` | ||
| 156 | - **Environment vars:** `../ngit-relay/.env.example` | ||
| 157 | - **Documentation:** `../ngit-relay/README.md` | ||
| 158 | |||
| 159 | --- | ||
| 160 | |||
| 161 | ## 🔜 Next Steps | ||
| 162 | |||
| 163 | Now that we can test against ngit-relay, we're ready to: | ||
| 164 | |||
| 165 | 1. ✅ **Verify current NIP-01 smoke tests work** against ngit-relay | ||
| 166 | 2. 🔜 **Implement GRASP-01 tests** one at a time (per plan in work/current_status.md) | ||
| 167 | 3. 🔜 **Validate each test** against reference implementation | ||
| 168 | 4. 🔜 **Document any behavioral differences** we discover | ||
| 169 | |||
| 170 | --- | ||
| 171 | |||
| 172 | **Ready to proceed with test implementation!** | ||
| 173 | |||
| 174 | The plan in `work/current_status.md` calls for implementing GRASP-01 tests one at a time, each in a fresh session, validating against ngit-relay. | ||
| 175 | |||
| 176 | We now have the infrastructure to do exactly that. ✅ | ||