fix: improve reload_test CI stability

This commit is contained in:
2026-02-03 21:36:33 +08:00
parent 7b6a807f4f
commit 7c1bc9d4a9
3 changed files with 25 additions and 4 deletions

View File

@@ -32,5 +32,5 @@ See [config_example.yaml](config_example.yaml).
- [ ] SQLite/MySQL Adapters (Future)
- [ ] Documentation & Testing
- [x] Basic End-to-end tests
- [ ] Comprehensive Unit Tests
- [x] Comprehensive Unit Tests
- [ ] Deployment Guide

View File

@@ -32,5 +32,5 @@ traudit 是一个支持 TCP/UDP/Unix Socket 的反向代理程序,专注于连
- [ ] SQLite/MySQL 适配器 (计划中)
- [ ] 文档与测试
- [x] 基础端到端测试
- [ ] 单元测试
- [x] 单元测试
- [ ] 部署文档

View File

@@ -102,6 +102,14 @@ services:
let config_path = std::env::temp_dir().join("stress_test.yaml");
std::fs::write(&config_path, config_content)?;
// Pre-build to ensure cargo run doesn't time out compiling
let _ = Command::new("cargo")
.arg("build")
.arg("--bin")
.arg("traudit")
.status()
.await?;
// Start Traudit using cargo run to ensure correct binary execution
let mut _child = Command::new("cargo")
.arg("run")
@@ -114,8 +122,21 @@ services:
.stderr(std::process::Stdio::null())
.spawn()?;
// Give it time to start
tokio::time::sleep(Duration::from_secs(5)).await;
// Wait for port to be open (up to 30s)
let addr = format!("127.0.0.1:{}", t_tcp_port);
let mut started = false;
for _ in 0..60 {
// 30s total (500ms * 60)
if TcpStream::connect(&addr).await.is_ok() {
started = true;
break;
}
tokio::time::sleep(Duration::from_millis(500)).await;
}
if !started {
panic!("Traudit failed to start on port {} within 30s", t_tcp_port);
}
// Run Test Loop for 10 seconds generating mixed traffic