diff --git a/common/management/Cargo.toml b/common/management/Cargo.toml index 03a4df181d71..d325cc83de45 100644 --- a/common/management/Cargo.toml +++ b/common/management/Cargo.toml @@ -8,6 +8,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +doctest = false +test = false + [dependencies] common-base= {path = "../base" } common-exception= {path = "../exception"} diff --git a/common/management/src/cluster/mod.rs b/common/management/src/cluster/mod.rs index 2245e47047c2..3650ba7c33d7 100644 --- a/common/management/src/cluster/mod.rs +++ b/common/management/src/cluster/mod.rs @@ -13,9 +13,6 @@ // limitations under the License. // -#[cfg(test)] -mod cluster_mgr_test; - mod cluster_api; mod cluster_mgr; diff --git a/common/management/src/lib.rs b/common/management/src/lib.rs index 207f7d19e7cf..c89b28e60ab3 100644 --- a/common/management/src/lib.rs +++ b/common/management/src/lib.rs @@ -20,4 +20,5 @@ pub use cluster::ClusterApi; pub use cluster::ClusterMgr; pub use user::user_api::UserInfo; pub use user::user_api::UserMgrApi; +pub use user::user_mgr::format_user_key; pub use user::user_mgr::UserMgr; diff --git a/common/management/src/user/mod.rs b/common/management/src/user/mod.rs index 29c93c57c193..7633b5c9313c 100644 --- a/common/management/src/user/mod.rs +++ b/common/management/src/user/mod.rs @@ -15,6 +15,3 @@ pub(crate) mod user_api; pub(crate) mod user_mgr; - -#[cfg(test)] -mod user_mgr_test; diff --git a/common/management/src/cluster/cluster_mgr_test.rs b/common/management/tests/it/cluster.rs similarity index 98% rename from common/management/src/cluster/cluster_mgr_test.rs rename to common/management/tests/it/cluster.rs index cbb8a204ab9b..715b28e729e7 100644 --- a/common/management/src/cluster/cluster_mgr_test.rs +++ b/common/management/tests/it/cluster.rs @@ -19,14 +19,12 @@ use std::time::UNIX_EPOCH; use common_base::tokio; use common_exception::Result; +use common_management::*; use common_meta_api::KVApi; use common_meta_embedded::MetaEmbedded; use common_meta_types::NodeInfo; use common_meta_types::SeqV; -use super::*; -use crate::cluster::cluster_mgr::ClusterMgr; - #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_successfully_add_node() -> Result<()> { let current_time = current_seconds_time(); diff --git a/common/management/tests/it/main.rs b/common/management/tests/it/main.rs new file mode 100644 index 000000000000..0ef6155a1214 --- /dev/null +++ b/common/management/tests/it/main.rs @@ -0,0 +1,16 @@ +// Copyright 2020 Datafuse Labs. +// +// 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. + +mod cluster; +mod user; diff --git a/common/management/src/user/user_mgr_test.rs b/common/management/tests/it/user.rs similarity index 99% rename from common/management/src/user/user_mgr_test.rs rename to common/management/tests/it/user.rs index 2bccc02b3e26..6e157c97e8a0 100644 --- a/common/management/src/user/user_mgr_test.rs +++ b/common/management/tests/it/user.rs @@ -18,6 +18,7 @@ use std::sync::Arc; use async_trait::async_trait; use common_base::tokio; use common_exception::ErrorCode; +use common_management::*; use common_meta_api::KVApi; use common_meta_types::GetKVActionReply; use common_meta_types::MGetKVActionReply; @@ -30,11 +31,6 @@ use common_meta_types::UpsertKVActionReply; use mockall::predicate::*; use mockall::*; -use crate::user::user_api::UserInfo; -use crate::user::user_api::UserMgrApi; -use crate::user::user_mgr::format_user_key; -use crate::UserMgr; - // and mock! mock! { pub KV {}