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)
|
- [ ] SQLite/MySQL Adapters (Future)
|
||||||
- [ ] Documentation & Testing
|
- [ ] Documentation & Testing
|
||||||
- [x] Basic End-to-end tests
|
- [x] Basic End-to-end tests
|
||||||
- [ ] Comprehensive Unit Tests
|
- [x] Comprehensive Unit Tests
|
||||||
- [ ] Deployment Guide
|
- [ ] Deployment Guide
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ traudit 是一个支持 TCP/UDP/Unix Socket 的反向代理程序,专注于连
|
|||||||
- [ ] SQLite/MySQL 适配器 (计划中)
|
- [ ] SQLite/MySQL 适配器 (计划中)
|
||||||
- [ ] 文档与测试
|
- [ ] 文档与测试
|
||||||
- [x] 基础端到端测试
|
- [x] 基础端到端测试
|
||||||
- [ ] 单元测试
|
- [x] 单元测试
|
||||||
- [ ] 部署文档
|
- [ ] 部署文档
|
||||||
|
|||||||
@@ -102,6 +102,14 @@ services:
|
|||||||
let config_path = std::env::temp_dir().join("stress_test.yaml");
|
let config_path = std::env::temp_dir().join("stress_test.yaml");
|
||||||
std::fs::write(&config_path, config_content)?;
|
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
|
// Start Traudit using cargo run to ensure correct binary execution
|
||||||
let mut _child = Command::new("cargo")
|
let mut _child = Command::new("cargo")
|
||||||
.arg("run")
|
.arg("run")
|
||||||
@@ -114,8 +122,21 @@ services:
|
|||||||
.stderr(std::process::Stdio::null())
|
.stderr(std::process::Stdio::null())
|
||||||
.spawn()?;
|
.spawn()?;
|
||||||
|
|
||||||
// Give it time to start
|
// Wait for port to be open (up to 30s)
|
||||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
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
|
// Run Test Loop for 10 seconds generating mixed traffic
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user