This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
当前首版只放无业务规则的 smoke/HTTP 通用断言:
|
||||
|
||||
1. Maincloud healthz 默认地址常量
|
||||
1. api-server healthz 默认地址常量
|
||||
2. smoke URL 空值与尾斜杠归一化
|
||||
3. HTTP 2xx 状态码断言
|
||||
4. healthz 非空响应体断言
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::fmt;
|
||||
|
||||
pub const DEFAULT_MAINCLOUD_HEALTHZ_URL: &str = "http://127.0.0.1:3100/healthz";
|
||||
pub const DEFAULT_API_SERVER_HEALTHZ_URL: &str = "http://127.0.0.1:3100/healthz";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct SmokeAssertionError {
|
||||
@@ -32,7 +32,7 @@ impl std::error::Error for SmokeAssertionError {}
|
||||
pub fn normalize_smoke_url(input: impl AsRef<str>) -> String {
|
||||
let trimmed = input.as_ref().trim();
|
||||
if trimmed.is_empty() {
|
||||
return DEFAULT_MAINCLOUD_HEALTHZ_URL.to_string();
|
||||
return DEFAULT_API_SERVER_HEALTHZ_URL.to_string();
|
||||
}
|
||||
|
||||
trimmed.trim_end_matches('/').to_string()
|
||||
@@ -63,10 +63,10 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn normalize_smoke_url_uses_maincloud_healthz_when_empty() {
|
||||
fn normalize_smoke_url_uses_api_server_healthz_when_empty() {
|
||||
assert_eq!(
|
||||
normalize_smoke_url(" "),
|
||||
DEFAULT_MAINCLOUD_HEALTHZ_URL.to_string()
|
||||
DEFAULT_API_SERVER_HEALTHZ_URL.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user