develop #2

Merged
jenkins merged 49 commits from develop into main 2026-04-08 19:55:46 +08:00
2 changed files with 77 additions and 138 deletions
Showing only changes of commit d65537529a - Show all commits
+14
View File
@@ -0,0 +1,14 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
public class TestBCrypt {
public static void main(String[] args) {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);
String password = "admin123";
String hash = "$2b$12$SFefXlGRFMA0fvxIufpWPuIAl0OPLgRDoCZPThCvjpiJGPYS8yNYy";
System.out.println("测试密码验证:");
System.out.println("密码: " + password);
System.out.println("哈希: " + hash);
System.out.println("验证结果: " + encoder.matches(password, hash));
}
}
-75
View File
@@ -9,7 +9,6 @@ const __dirname = path.dirname(__filename);
let backendProcess: ChildProcess | null = null;
let gatewayProcess: ChildProcess | null = null;
let frontendProcess: ChildProcess | null = null;
let healthCheckInterval: NodeJS.Timeout | null = null;
async function checkBackendHealth(): Promise<boolean> {
@@ -220,49 +219,6 @@ async function globalSetup(config: FullConfig) {
console.log('⏳ 等待网关服务就绪...');
await waitForGatewayReady();
const frontendDir = path.resolve(__dirname, '..');
console.log('🌐 启动前端服务...');
console.log(` 目录: ${frontendDir}`);
frontendProcess = spawn('pnpm', ['run', 'dev'], {
cwd: frontendDir,
stdio: 'pipe',
shell: true,
detached: false,
env: { ...process.env, NODE_ENV: 'test' }
});
if (frontendProcess.stdout) {
frontendProcess.stdout.on('data', (data) => {
const output = data.toString();
if (output.includes('Local:') || output.includes('localhost:3002')) {
console.log('✅ 前端服务启动成功');
}
});
}
if (frontendProcess.stderr) {
frontendProcess.stderr.on('data', (data) => {
const output = data.toString();
if (output.includes('ERROR') || output.includes('error')) {
console.error('❌ 前端服务启动错误:', output);
}
});
}
frontendProcess.on('error', (error) => {
console.error('❌ 前端服务启动失败:', error);
});
frontendProcess.on('exit', (code, signal) => {
if (code !== 0 && code !== null) {
console.error(`❌ 前端服务异常退出,退出码: ${code}, 信号: ${signal}`);
}
});
console.log('⏳ 等待前端服务就绪...');
await waitForFrontendReady();
console.log('🔍 验证所有服务连通性...');
await verifyAllServices();
@@ -289,13 +245,6 @@ async function verifyAllServices(): Promise<void> {
}
console.log(' ✅ 网关服务正常');
console.log(' 验证前端服务...');
const frontendOk = await checkFrontendHealth();
if (!frontendOk) {
throw new Error('❌ 前端服务验证失败');
}
console.log(' ✅ 前端服务正常');
console.log(' 验证网关到后端的连通性...');
try {
const response = await fetch('http://localhost:8080/api/auth/login', {
@@ -577,30 +526,6 @@ async function globalTeardown() {
});
}
if (frontendProcess) {
console.log('🛑 停止前端服务...');
frontendProcess.kill('SIGTERM');
await new Promise<void>((resolve) => {
if (frontendProcess) {
frontendProcess.on('exit', () => {
console.log('✅ 前端服务已停止');
resolve();
});
setTimeout(() => {
if (frontendProcess) {
frontendProcess.kill('SIGKILL');
console.log('⚠️ 强制停止前端服务');
resolve();
}
}, 10000);
} else {
resolve();
}
});
}
console.log('✅ 全局测试环境清理完成');
}