mirror of
https://github.com/awfufu/traudit
synced 2026-03-01 05:29:44 +08:00
fix: improve reload_test CI stability
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -32,5 +32,5 @@ traudit 是一个支持 TCP/UDP/Unix Socket 的反向代理程序,专注于连
|
||||
- [ ] SQLite/MySQL 适配器 (计划中)
|
||||
- [ ] 文档与测试
|
||||
- [x] 基础端到端测试
|
||||
- [ ] 单元测试
|
||||
- [x] 单元测试
|
||||
- [ ] 部署文档
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user