Skip to content

Commit

Permalink
Merge pull request #2792 from PsiACE/management-tests
Browse files Browse the repository at this point in the history
[test] apply the new test style to common-management
  • Loading branch information
BohuTANG authored Nov 15, 2021
2 parents e66666a + b0c5ec5 commit a1f2078
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions common/management/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
3 changes: 0 additions & 3 deletions common/management/src/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
// limitations under the License.
//

#[cfg(test)]
mod cluster_mgr_test;

mod cluster_api;
mod cluster_mgr;

Expand Down
1 change: 1 addition & 0 deletions common/management/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 0 additions & 3 deletions common/management/src/user/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

pub(crate) mod user_api;
pub(crate) mod user_mgr;

#[cfg(test)]
mod user_mgr_test;
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 16 additions & 0 deletions common/management/tests/it/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {}
Expand Down

0 comments on commit a1f2078

Please sign in to comment.