From 383e5717f54af5ca8668d5ce0841d50d94ba55e4 Mon Sep 17 00:00:00 2001 From: tison Date: Tue, 28 May 2024 09:44:24 +0800 Subject: [PATCH] tidy Signed-off-by: tison --- src/client/src/lib.rs | 4 ++-- src/cmd/src/cli.rs | 2 +- src/cmd/src/cli/export.rs | 14 ++++++-------- tests-integration/src/test_util.rs | 2 +- tests-integration/tests/grpc.rs | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/client/src/lib.rs b/src/client/src/lib.rs index 713faba658df..0741c8e1c7a6 100644 --- a/src/client/src/lib.rs +++ b/src/client/src/lib.rs @@ -16,12 +16,12 @@ mod client; pub mod client_manager; +#[cfg(feature = "testing")] +mod database; pub mod error; pub mod load_balance; mod metrics; pub mod region; -#[cfg(feature = "testing")] -mod database; pub use api; use api::v1::greptime_response::Response; diff --git a/src/cmd/src/cli.rs b/src/cmd/src/cli.rs index 9933704ba32d..fc443a169d2b 100644 --- a/src/cmd/src/cli.rs +++ b/src/cmd/src/cli.rs @@ -31,8 +31,8 @@ use async_trait::async_trait; use bench::BenchTableMetadataCommand; use clap::Parser; use common_telemetry::logging::{LoggingOptions, TracingOptions}; -use tracing_appender::non_blocking::WorkerGuard; pub use repl::Repl; +use tracing_appender::non_blocking::WorkerGuard; use upgrade::UpgradeCommand; use self::export::ExportCommand; diff --git a/src/cmd/src/cli/export.rs b/src/cmd/src/cli/export.rs index f3781c6844dc..00d916407458 100644 --- a/src/cmd/src/cli/export.rs +++ b/src/cmd/src/cli/export.rs @@ -17,10 +17,14 @@ use std::path::Path; use std::sync::Arc; use async_trait::async_trait; -use base64::Engine; use base64::engine::general_purpose; +use base64::Engine; use clap::{Parser, ValueEnum}; +use client::DEFAULT_SCHEMA_NAME; +use common_telemetry::{debug, error, info, warn}; use serde_json::Value; +use servers::http::greptime_result_v1::GreptimedbV1Response; +use servers::http::GreptimeQueryOutput; use snafu::{OptionExt, ResultExt}; use tokio::fs::File; use tokio::io::{AsyncWriteExt, BufWriter}; @@ -28,11 +32,6 @@ use tokio::sync::Semaphore; use tokio::time::Instant; use tracing_appender::non_blocking::WorkerGuard; -use client::DEFAULT_SCHEMA_NAME; -use common_telemetry::{debug, error, info, warn}; -use servers::http::greptime_result_v1::GreptimedbV1Response; -use servers::http::GreptimeQueryOutput; - use crate::cli::{Instance, Tool}; use crate::error::{ EmptyResultSnafu, Error, FileIoSnafu, HttpQuerySqlSnafu, InvalidDatabaseNameSnafu, Result, @@ -439,14 +438,13 @@ fn split_database(database: &str) -> Result<(String, Option)> { #[cfg(test)] mod tests { use clap::Parser; - use client::{Client, Database}; use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME}; use common_telemetry::logging::LoggingOptions; - use crate::{App, cli, standalone}; use crate::error::Result as CmdResult; use crate::options::GlobalOptions; + use crate::{cli, standalone, App}; #[tokio::test(flavor = "multi_thread")] async fn test_export_create_table_with_quoted_names() -> CmdResult<()> { diff --git a/tests-integration/src/test_util.rs b/tests-integration/src/test_util.rs index 35ce52e273bd..7cbd640820b1 100644 --- a/tests-integration/src/test_util.rs +++ b/tests-integration/src/test_util.rs @@ -21,6 +21,7 @@ use std::time::Duration; use auth::UserProviderRef; use axum::Router; use catalog::kvbackend::KvBackendCatalogManager; +use client::Database; use common_base::secrets::ExposeSecret; use common_config::Configurable; use common_meta::key::catalog_name::CatalogNameKey; @@ -56,7 +57,6 @@ use servers::tls::ReloadableTlsServerConfig; use servers::Mode; use session::context::QueryContext; -use crate::database::Database; use crate::standalone::{GreptimeDbStandalone, GreptimeDbStandaloneBuilder}; pub const PEER_PLACEHOLDER_ADDR: &str = "127.0.0.1:3001"; diff --git a/tests-integration/tests/grpc.rs b/tests-integration/tests/grpc.rs index a7956726cbf1..7d1f9d57768f 100644 --- a/tests-integration/tests/grpc.rs +++ b/tests-integration/tests/grpc.rs @@ -22,7 +22,7 @@ use api::v1::{ PromqlRequest, RequestHeader, SemanticType, }; use auth::user_provider_from_option; -use client::{Client, OutputData, DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME, Database}; +use client::{Client, Database, OutputData, DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME}; use common_catalog::consts::MITO_ENGINE; use common_grpc::channel_manager::ClientTlsOption; use common_query::Output;