test: add api and doc http test (#998)

* test:add api and doc test

* fix:conservation
This commit is contained in:
Xieqijun
2023-02-15 11:55:13 +08:00
committed by GitHub
parent 4d8276790b
commit 63e396e9e9
2 changed files with 39 additions and 0 deletions

View 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);
}

View File

@@ -14,6 +14,7 @@
mod authorize;
mod http_handler_test;
mod http_test;
mod influxdb_test;
mod opentsdb_test;
mod prometheus_test;