diff --git a/src/servers/tests/http/http_test.rs b/src/servers/tests/http/http_test.rs new file mode 100644 index 0000000000..cf4ca38b07 --- /dev/null +++ b/src/servers/tests/http/http_test.rs @@ -0,0 +1,38 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use axum::Router; +use axum_test_helper::TestClient; +use servers::http::{HttpOptions, HttpServer}; +use table::test_util::MemTable; + +use crate::create_testing_sql_query_handler; + +fn make_test_app() -> Router { + let server = HttpServer::new( + create_testing_sql_query_handler(MemTable::default_numbers_table()), + HttpOptions::default(), + ); + server.make_app() +} + +#[tokio::test] +async fn test_api_and_doc() { + let app = make_test_app(); + let client = TestClient::new(app); + let result = client.get("/v1/private/api.json").send().await; + assert_eq!(result.status(), 200); + let result = client.get("/v1/private/docs").send().await; + assert_eq!(result.status(), 200); +} diff --git a/src/servers/tests/http/mod.rs b/src/servers/tests/http/mod.rs index 5a39ed348e..0987af9f90 100644 --- a/src/servers/tests/http/mod.rs +++ b/src/servers/tests/http/mod.rs @@ -14,6 +14,7 @@ mod authorize; mod http_handler_test; +mod http_test; mod influxdb_test; mod opentsdb_test; mod prometheus_test;