Files
p2ns/test-scripts/plugins-smoke.js
T
Raven Scott ea9124c429 BREAKING EXPERIMENTAL: Holepunch-native hard migration (RPC core, shared storage, SDK v2)
BREAKING: All nodes must upgrade together. Legacy p2ns.core-request string
messages are rejected; invite/consensus control plane uses protomux-rpc
(invite.request, invite.ack, invite.relay*, consensus.*). Shared Corestore
namespaces are the default for plugin DBs and drives; USE_SHARED_CORESTORE_NAMESPACES=false
is debug-only. Admin plugin actions with params are validated before run.

EXPERIMENTAL: End-to-end RPC invite path reuses existing handlers via adapters;
invite wire still ships on the invite channel. Multi-peer invite/relay
integration tests are not in CI yet (core-rpc-smoke only).

SDK & channels:
- channel-rpc.js, sdk.channels.rpc (register/request/event)
- core-rpc.js for p2ns.core; action-params + plugin route validation
- sdk.db.getCore/reopen, sdk.state.getPeerChannelSnapshot,
  sdk.metrics.getHolepunchStats (schema v1)

Runtime:
- p2ns.js: RPC-first core invite/consensus; Hyperswarm firewall/reconnect
- channel-manager: required protomux-rpc per peer
- db-shared-namespace-migration; drive-manager shared namespaces
- proxy-server: invite.request RPC for joiners

Plugins: file.drop, global.profile, peer.directory, domain.consensus,
peer.visualize, example.plugin (RPC demo); peer.directory UI polish

Also: CI/smoke scripts, diagnostics hardening, plugin config schema validation,
admin action param modal, docs/RFCS, package-lock + engines.node >= 18
2026-05-28 10:51:19 -04:00

51 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
/*
* Built-in plugin smoke validation script
* Usage:
* node test-scripts/plugins-smoke.js
*/
if (process.env.SKIP_SMOKE_TESTS === '1') {
console.log('plugin smoke checks skipped (SKIP_SMOKE_TESTS=1)');
process.exit(0);
}
const targets = {
peerDirectory: process.env.PEER_DIRECTORY_URL || 'https://peer.directory',
globalProfile: process.env.GLOBAL_PROFILE_URL || 'https://global.profile',
fileDrop: process.env.FILE_DROP_URL || 'https://file.drop'
};
async function checkPeerDirectory() {
const response = await fetch(`${targets.peerDirectory}/domains?page=1&limit=25&sort=type`);
const json = await response.json();
if (!response.ok) throw new Error(`peer.directory domains failed: ${response.status}`);
if (!Array.isArray(json.domains)) throw new Error('peer.directory domains payload missing domains[]');
}
async function checkGlobalProfile() {
const response = await fetch(`${targets.globalProfile}/api/profiles?page=1&limit=10`);
const json = await response.json();
if (!response.ok) throw new Error(`global.profile profiles failed: ${response.status}`);
if (!Array.isArray(json.profiles)) throw new Error('global.profile payload missing profiles[]');
}
async function checkFileDrop() {
const response = await fetch(`${targets.fileDrop}/api/files`);
const json = await response.json();
if (!response.ok) throw new Error(`file.drop files failed: ${response.status}`);
if (!Array.isArray(json.files)) throw new Error('file.drop payload missing files[]');
}
async function run() {
await checkPeerDirectory();
await checkGlobalProfile();
await checkFileDrop();
console.log('plugin smoke checks passed');
}
run().catch((err) => {
console.error(`plugin smoke checks failed: ${err.message}`);
process.exit(1);
});