初版gitlab合并test mcp
This commit is contained in:
1 parent
227d77f586
commit
0ccc8b625b
6 files changed
+2866
-35
No files matched your search
@@ -0,0 +1,42 @@
|
||||
// 简单的测试文件,用于验证GitLab MCP服务器的基本功能
|
||||
import { spawn } from 'child_process';
|
||||
import { setTimeout } from 'timers/promises';
|
||||
|
||||
// 注意:这是一个概念验证测试,实际测试需要实际的GitLab项目和有效的API令牌
|
||||
console.log('开始测试GitLab MCP服务器...');
|
||||
|
||||
// 测试GitLab MCP服务器是否能正常启动
|
||||
async function testServerStartup() {
|
||||
console.log('测试GitLab MCP服务器启动...');
|
||||
|
||||
// 启动服务器进程
|
||||
const serverProcess = spawn('node', ['gitlab-index.js'], {
|
||||
stdio: ['pipe', 'pipe', 'pipe']
|
||||
});
|
||||
|
||||
// 监听服务器输出
|
||||
serverProcess.stderr.on('data', (data) => {
|
||||
const output = data.toString();
|
||||
console.log(`服务器输出: ${output}`);
|
||||
|
||||
if (output.includes('GitLab MCP 服务器已通过 stdio 启动')) {
|
||||
console.log('✓ 服务器成功启动');
|
||||
}
|
||||
});
|
||||
|
||||
serverProcess.on('error', (err) => {
|
||||
console.error('✗ 服务器启动失败:', err.message);
|
||||
});
|
||||
|
||||
// 等待一段时间后终止进程
|
||||
await setTimeout(2000); // 等待2秒
|
||||
serverProcess.kill();
|
||||
console.log('服务器测试完成');
|
||||
}
|
||||
|
||||
// 服务器启动测试
|
||||
testServerStartup().then(() => {
|
||||
console.log('所有测试完成');
|
||||
}).catch((error) => {
|
||||
console.error('测试过程中发生错误:', error);
|
||||
});
|
||||
Reference in new issue
Block a user