From 4b919a4b5a98dee3c16ca2900121a29a252e96ca Mon Sep 17 00:00:00 2001 From: Renjie Liu Date: Mon, 4 Dec 2023 11:04:03 +0800 Subject: [PATCH] use mod instead of crate for test utils --- Cargo.toml | 2 +- crates/catalog/rest/Cargo.toml | 3 ++- .../catalog/rest/tests/rest_catalog_test.rs | 4 +++ crates/test_utils/Cargo.toml | 25 ------------------- crates/test_utils/{src => }/cmd.rs | 0 crates/test_utils/{src => }/docker.rs | 2 +- crates/test_utils/{src/lib.rs => mod.rs} | 2 +- 7 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 crates/test_utils/Cargo.toml rename crates/test_utils/{src => }/cmd.rs (100%) rename crates/test_utils/{src => }/docker.rs (98%) rename crates/test_utils/{src/lib.rs => mod.rs} (98%) diff --git a/Cargo.toml b/Cargo.toml index 78763aa8c..99024fdc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ [workspace] resolver = "2" -members = ["crates/catalog/*", "crates/iceberg", "crates/test_utils"] +members = ["crates/catalog/*", "crates/iceberg"] [workspace.dependencies] anyhow = "1.0.72" diff --git a/crates/catalog/rest/Cargo.toml b/crates/catalog/rest/Cargo.toml index ff0eb9111..6fa57e908 100644 --- a/crates/catalog/rest/Cargo.toml +++ b/crates/catalog/rest/Cargo.toml @@ -41,7 +41,8 @@ urlencoding = { workspace = true } uuid = { workspace = true, features = ["v4"] } [dev-dependencies] -iceberg_test_utils = { path = "../../test_utils" } +env_logger = { workspace = true } +log = "0.4.20" mockito = { workspace = true } port_scanner = { workspace = true } tokio = { workspace = true } diff --git a/crates/catalog/rest/tests/rest_catalog_test.rs b/crates/catalog/rest/tests/rest_catalog_test.rs index a4d07955b..dba696abf 100644 --- a/crates/catalog/rest/tests/rest_catalog_test.rs +++ b/crates/catalog/rest/tests/rest_catalog_test.rs @@ -16,6 +16,10 @@ // under the License. //! Integration tests for rest catalog. +//! + +#[path = "../../../test_utils/mod.rs"] +mod iceberg_test_utils; use iceberg::spec::{FormatVersion, NestedField, PrimitiveType, Schema, Type}; use iceberg::transaction::Transaction; diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml deleted file mode 100644 index 178ec5ec0..000000000 --- a/crates/test_utils/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -[package] -name = "iceberg_test_utils" -version = "0.1.0" -edition = "2021" - -[dependencies] -env_logger = { workspace = true } -log = "0.4.20" diff --git a/crates/test_utils/src/cmd.rs b/crates/test_utils/cmd.rs similarity index 100% rename from crates/test_utils/src/cmd.rs rename to crates/test_utils/cmd.rs diff --git a/crates/test_utils/src/docker.rs b/crates/test_utils/docker.rs similarity index 98% rename from crates/test_utils/src/docker.rs rename to crates/test_utils/docker.rs index 6c5fbef1e..adfb3771a 100644 --- a/crates/test_utils/src/docker.rs +++ b/crates/test_utils/docker.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -use crate::cmd::{get_cmd_output, run_command}; +use super::cmd::{get_cmd_output, run_command}; use std::process::Command; /// A utility to manage lifecycle of docker compose. diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/mod.rs similarity index 98% rename from crates/test_utils/src/lib.rs rename to crates/test_utils/mod.rs index c320f8540..a3b3f0adc 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/mod.rs @@ -19,8 +19,8 @@ //! //! It's not intended for use outside of `iceberg-rust`. +#![allow(dead_code)] use std::sync::Once; - mod cmd; pub mod docker;