Skip to content

Commit b0c5ec5

Browse files
committed
[test] apply the new test style to common-management
Signed-off-by: Chojan Shang <[email protected]>
1 parent 2cbfa94 commit b0c5ec5

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

common/management/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ edition = "2021"
88

99
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1010

11+
[lib]
12+
doctest = false
13+
test = false
14+
1115
[dependencies]
1216
common-base= {path = "../base" }
1317
common-exception= {path = "../exception"}

common/management/src/cluster/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
// limitations under the License.
1414
//
1515

16-
#[cfg(test)]
17-
mod cluster_mgr_test;
18-
1916
mod cluster_api;
2017
mod cluster_mgr;
2118

common/management/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ pub use cluster::ClusterApi;
2020
pub use cluster::ClusterMgr;
2121
pub use user::user_api::UserInfo;
2222
pub use user::user_api::UserMgrApi;
23+
pub use user::user_mgr::format_user_key;
2324
pub use user::user_mgr::UserMgr;

common/management/src/user/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@
1515

1616
pub(crate) mod user_api;
1717
pub(crate) mod user_mgr;
18-
19-
#[cfg(test)]
20-
mod user_mgr_test;

common/management/src/cluster/cluster_mgr_test.rs renamed to common/management/tests/it/cluster.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ use std::time::UNIX_EPOCH;
1919

2020
use common_base::tokio;
2121
use common_exception::Result;
22+
use common_management::*;
2223
use common_meta_api::KVApi;
2324
use common_meta_embedded::MetaEmbedded;
2425
use common_meta_types::NodeInfo;
2526
use common_meta_types::SeqV;
2627

27-
use super::*;
28-
use crate::cluster::cluster_mgr::ClusterMgr;
29-
3028
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
3129
async fn test_successfully_add_node() -> Result<()> {
3230
let current_time = current_seconds_time();

common/management/tests/it/main.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2020 Datafuse Labs.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
mod cluster;
16+
mod user;

common/management/src/user/user_mgr_test.rs renamed to common/management/tests/it/user.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::sync::Arc;
1818
use async_trait::async_trait;
1919
use common_base::tokio;
2020
use common_exception::ErrorCode;
21+
use common_management::*;
2122
use common_meta_api::KVApi;
2223
use common_meta_types::GetKVActionReply;
2324
use common_meta_types::MGetKVActionReply;
@@ -30,11 +31,6 @@ use common_meta_types::UpsertKVActionReply;
3031
use mockall::predicate::*;
3132
use mockall::*;
3233

33-
use crate::user::user_api::UserInfo;
34-
use crate::user::user_api::UserMgrApi;
35-
use crate::user::user_mgr::format_user_key;
36-
use crate::UserMgr;
37-
3834
// and mock!
3935
mock! {
4036
pub KV {}

0 commit comments

Comments
 (0)