feat: sidecar 与 Info 响应加监听地址字段

This commit is contained in:
2026-10-11 15:51:20 +00:00
parent 6e34c53cb8
commit d770107445
11 changed files with 104 additions and 35 deletions
+7 -1
View File
@@ -715,8 +715,14 @@ fn server_start_port_e2e() {
}
let response = send_control_request(&ServerRequest::Info).expect("信息臂应成功");
match response {
ServerResponse::Info { version, socket_path, pid } => {
ServerResponse::Info {
version,
socket_path,
pid,
listen_addr,
} => {
assert_eq!(socket_path, format!("127.0.0.1:{port}"), "Info 端点应为自定义端口");
assert_eq!(listen_addr, format!("127.0.0.1:{port}"), "Info 监听地址应为自定义端口");
assert_eq!(version, env!("CARGO_PKG_VERSION"), "版本应与构建期版本一致");
assert_eq!(pid, id.pid, "Info 进程号应与 sidecar 一致");
}
+17 -4
View File
@@ -80,11 +80,17 @@ fn control_client_end_to_end() {
"healthy 应为真:{response:?}"
);
// 信息请求:socket 路径与配置一致、进程号为当前进程号。
// 信息请求:socket 路径与配置一致、监听地址与配置一致、进程号为当前进程号。
let response = send_control_request_from(&config.sidecar_path, &ServerRequest::Info).expect("信息请求应成功");
match response {
ServerResponse::Info { socket_path, pid, .. } => {
ServerResponse::Info {
socket_path,
pid,
listen_addr,
..
} => {
assert_eq!(socket_path, config.endpoint.describe(), "socket 路径应与配置一致");
assert_eq!(listen_addr, config.endpoint.describe(), "监听地址应与配置一致(Unix 臂)");
assert_eq!(pid, std::process::id(), "进程号应为当前进程号");
}
other => panic!("应得 Info 帧,实得 {other:?}"),
@@ -148,11 +154,18 @@ fn control_client_tcp_arm_end_to_end() {
"healthy 应为真:{response:?}"
);
// 信息请求:endpoint 值与配置一致(host:port 文本形态)、进程号为当前进程号。
// 信息请求:endpoint 值与配置一致(host:port 文本形态)、监听地址与配置一致、
// 进程号为当前进程号。
let response = send_control_request_from(&config.sidecar_path, &ServerRequest::Info).expect("信息请求应成功");
match response {
ServerResponse::Info { socket_path, pid, .. } => {
ServerResponse::Info {
socket_path,
pid,
listen_addr,
..
} => {
assert_eq!(socket_path, config.endpoint.describe(), "endpoint 值应与配置一致");
assert_eq!(listen_addr, config.endpoint.describe(), "监听地址应与配置一致(TCP 臂)");
assert_eq!(pid, std::process::id(), "进程号应为当前进程号");
}
other => panic!("应得 Info 帧,实得 {other:?}"),