-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-deployment.js
More file actions
100 lines (85 loc) · 2.44 KB
/
test-deployment.js
File metadata and controls
100 lines (85 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env node
import { spawn } from 'child_process';
console.log('🚀 Testing Solana MCP Server Deployment Readiness\n');
// Test the server startup time
const startTime = Date.now();
const server = spawn('node', ['dist/index.js'], {
stdio: ['pipe', 'pipe', 'pipe']
});
let serverReady = false;
let testResults = [];
server.stdout.on('data', (data) => {
if (!serverReady) {
const startupTime = Date.now() - startTime;
console.log(`✅ Server started in ${startupTime}ms`);
serverReady = true;
// Test basic functionality
testBasicFunctionality();
}
try {
const response = JSON.parse(data.toString());
if (response.result) {
testResults.push({ success: true, response });
console.log('✅ Command executed successfully');
}
} catch (e) {
// Ignore non-JSON output
}
});
server.stderr.on('data', (data) => {
const message = data.toString();
if (message.includes('Solana MCP server running')) {
console.log('📡 Server is running and ready');
}
});
server.on('close', (code) => {
const totalTime = Date.now() - startTime;
console.log(`\n📊 Deployment Test Results:`);
console.log(`- Server startup time: ${Date.now() - startTime}ms`);
console.log(`- Successful commands: ${testResults.length}`);
console.log(`- Exit code: ${code}`);
if (code === 0 && testResults.length > 0) {
console.log('🎉 Server is deployment-ready!');
} else {
console.log('⚠️ Server may have issues during deployment');
}
process.exit(0);
});
function testBasicFunctionality() {
// Test 1: List tools
setTimeout(() => {
console.log('🧪 Testing tool listing...');
server.stdin.write(JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "tools/list",
params: {}
}) + '\n');
}, 100);
// Test 2: Create wallet
setTimeout(() => {
console.log('🧪 Testing wallet creation...');
server.stdin.write(JSON.stringify({
jsonrpc: "2.0",
id: 2,
method: "tools/call",
params: {
name: "create_wallet",
arguments: { name: "deployment-test" }
}
}) + '\n');
}, 500);
// Close server after tests
setTimeout(() => {
console.log('🏁 Tests completed, closing server...');
server.kill();
}, 2000);
}
// Handle server startup timeout
setTimeout(() => {
if (!serverReady) {
console.log('❌ Server failed to start within 10 seconds');
server.kill();
process.exit(1);
}
}, 10000);