diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 5e4cc350bf..f2003ccf2c 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -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 diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml index 8686d6ef1c..a5a77ceb6e 100644 --- a/tests-integration/Cargo.toml +++ b/tests-integration/Cargo.toml @@ -4,6 +4,9 @@ version.workspace = true edition.workspace = true license.workspace = true +[features] +dashboard = [] + [dependencies] api = { path = "../src/api" } axum = "0.6" diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index 831a9a9b16..07db55cd3d 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -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::(&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) {}