diff options
| author | Your Name <you@example.com> | 2026-05-22 03:48:46 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-22 03:48:46 +0530 |
| commit | ed06f7eeab28c1fa6242c4ea6c3b9c933661fc06 (patch) | |
| tree | 96230dd069102688318f73b60b8322255ea30cad /tests/integration | |
| parent | 7009d2e0ac346376733863966374eac296e0471e (diff) | |
feat(cvm): fix CVM MCP roundtrip - task creation, subscription, relay selection
- Move CVM server start before mint_health_start (avoids RAM fragmentation)
- Fix NIP-01 subscription: #p tag must be array not string
- Fix read loop: tolerate TLS timeouts, don't disconnect
- Reduce TLS timeout from 15s to 5s for faster event delivery
- Add WS frame logging for debugging
- Sign test events with board's nsec (--sec flag) for owner auth
- Change default CVM relay to nos.lol (forwards ephemeral kind 25910)
- MCP get_config and get_balance roundtrips confirmed working
- Unit tests pass (16/16)
Diffstat (limited to 'tests/integration')
| -rw-r--r-- | tests/integration/test-cvm-roundtrip.mjs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/integration/test-cvm-roundtrip.mjs b/tests/integration/test-cvm-roundtrip.mjs index 821cfe7..87caf1a 100644 --- a/tests/integration/test-cvm-roundtrip.mjs +++ b/tests/integration/test-cvm-roundtrip.mjs | |||
| @@ -2,7 +2,7 @@ import { execSync } from 'child_process'; | |||
| 2 | import WebSocket from 'ws'; | 2 | import WebSocket from 'ws'; |
| 3 | 3 | ||
| 4 | const IP = process.env.TOLLGATE_IP || '10.192.45.1'; | 4 | const IP = process.env.TOLLGATE_IP || '10.192.45.1'; |
| 5 | const CVM_RELAY = process.env.CVM_RELAY || 'wss://relay.primal.net'; | 5 | const CVM_RELAY = process.env.CVM_RELAY || 'wss://nos.lol'; |
| 6 | const NSEC = process.env.CVM_NSEC || 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2'; | 6 | const NSEC = process.env.CVM_NSEC || 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2'; |
| 7 | 7 | ||
| 8 | let passed = 0, failed = 0; | 8 | let passed = 0, failed = 0; |
| @@ -104,7 +104,7 @@ async function runTests() { | |||
| 104 | params: { name: 'get_config', arguments: {} } | 104 | params: { name: 'get_config', arguments: {} } |
| 105 | }); | 105 | }); |
| 106 | 106 | ||
| 107 | const eventOut = nak(`event --kind 25910 --tag p=${npub} --content '${content.replace(/'/g, "'\\''")}' ${CVM_RELAY}`, 8000); | 107 | const eventOut = nak(`event --sec ${NSEC} --kind 25910 --tag p=${npub} --content '${content.replace(/'/g, "'\\''")}' ${CVM_RELAY}`, 8000); |
| 108 | const published = eventOut.includes('Success') || eventOut.includes('"id"'); | 108 | const published = eventOut.includes('Success') || eventOut.includes('"id"'); |
| 109 | assert(published, `Published kind 25910 get_config to ${CVM_RELAY}`); | 109 | assert(published, `Published kind 25910 get_config to ${CVM_RELAY}`); |
| 110 | 110 | ||
| @@ -149,7 +149,7 @@ async function runTests() { | |||
| 149 | params: { name: 'get_balance', arguments: {} } | 149 | params: { name: 'get_balance', arguments: {} } |
| 150 | }); | 150 | }); |
| 151 | 151 | ||
| 152 | const eventOut = nak(`event --kind 25910 --tag p=${npub} --content '${content.replace(/'/g, "'\\''")}' ${CVM_RELAY}`, 8000); | 152 | const eventOut = nak(`event --sec ${NSEC} --kind 25910 --tag p=${npub} --content '${content.replace(/'/g, "'\\''")}' ${CVM_RELAY}`, 8000); |
| 153 | const published = eventOut.includes('Success') || eventOut.includes('"id"'); | 153 | const published = eventOut.includes('Success') || eventOut.includes('"id"'); |
| 154 | assert(published, `Published kind 25910 get_balance to ${CVM_RELAY}`); | 154 | assert(published, `Published kind 25910 get_balance to ${CVM_RELAY}`); |
| 155 | 155 | ||