mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-03 20:02:54 +00:00
test: add integration case to check dashboard path (#1422)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
2
.github/workflows/develop.yml
vendored
2
.github/workflows/develop.yml
vendored
@@ -216,7 +216,7 @@ jobs:
|
||||
- name: Install cargo-llvm-cov
|
||||
uses: taiki-e/install-action@cargo-llvm-cov
|
||||
- name: Collect coverage data
|
||||
run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info -F pyo3_backend
|
||||
run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info -F pyo3_backend -F dashboard
|
||||
env:
|
||||
CARGO_BUILD_RUSTFLAGS: "-C link-arg=-fuse-ld=lld"
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
@@ -4,6 +4,9 @@ version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[features]
|
||||
dashboard = []
|
||||
|
||||
[dependencies]
|
||||
api = { path = "../src/api" }
|
||||
axum = "0.6"
|
||||
|
||||
@@ -58,6 +58,7 @@ macro_rules! http_tests {
|
||||
test_metrics_api,
|
||||
test_scripts_api,
|
||||
test_health_api,
|
||||
test_dashboard_path,
|
||||
);
|
||||
)*
|
||||
};
|
||||
@@ -401,3 +402,22 @@ pub async fn test_health_api(store_type: StorageType) {
|
||||
let body = serde_json::from_str::<HealthResponse>(&body_text).unwrap();
|
||||
assert_eq!(body, HealthResponse {});
|
||||
}
|
||||
|
||||
#[cfg(feature = "dashboard")]
|
||||
pub async fn test_dashboard_path(store_type: StorageType) {
|
||||
common_telemetry::init_default_ut_logging();
|
||||
let (app, _guard) = setup_test_http_app_with_frontend(store_type, "dashboard_path").await;
|
||||
let client = TestClient::new(app);
|
||||
|
||||
let res_post = client.post("/dashboard").send().await;
|
||||
assert_eq!(res_post.status(), StatusCode::OK);
|
||||
let res_get = client.get("/dashboard").send().await;
|
||||
assert_eq!(res_get.status(), StatusCode::OK);
|
||||
|
||||
// both `GET` and `POST` method return same result
|
||||
let body_text = res_post.text().await;
|
||||
assert_eq!(body_text, res_get.text().await);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "dashboard"))]
|
||||
pub async fn test_dashboard_path(_: StorageType) {}
|
||||
|
||||
Reference in New Issue
Block a user