mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-18 05:50:41 +00:00
test: add api and doc http test (#998)
* test:add api and doc test * fix:conservation
This commit is contained in:
38
src/servers/tests/http/http_test.rs
Normal file
38
src/servers/tests/http/http_test.rs
Normal file
@@ -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);
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
mod authorize;
|
||||
mod http_handler_test;
|
||||
mod http_test;
|
||||
mod influxdb_test;
|
||||
mod opentsdb_test;
|
||||
mod prometheus_test;
|
||||
|
||||
Reference in New Issue
Block a user