From cd80c03fee61d602cb4e393e9a82e9ad67640233 Mon Sep 17 00:00:00 2001 From: henry Date: Sat, 9 Mar 2024 11:50:16 +0900 Subject: [PATCH] Exclude tests {mongo, redis} using features (#1463) * build: separate test-redis as a feature * fix: exclude all mongo cases --- .github/workflows/rust.yml | 4 ++-- storages/mongo-storage/tests/mongo_indexes.rs | 2 ++ storages/mongo-storage/tests/mongo_storage.rs | 3 ++- storages/mongo-storage/tests/mongo_types.rs | 2 ++ storages/redis-storage/Cargo.toml | 3 +++ storages/redis-storage/tests/redis_errors.rs | 2 ++ storages/redis-storage/tests/redis_reconnect.rs | 2 ++ storages/redis-storage/tests/redis_store.rs | 4 ++-- storages/redis-storage/tests/redis_table.rs | 2 ++ 9 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 877c6e3d5..8a1892248 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -68,7 +68,7 @@ jobs: cd pkg/rust cargo test --lib --bins --tests --examples --verbose --no-default-features --features "memory-storage sled-storage" cd ../../ - + run_storage_tests: name: Run storage tests runs-on: ubuntu-latest @@ -112,7 +112,7 @@ jobs: redis-version: 6 - run: | cd storages/redis-storage - cargo test --verbose + cargo test --verbose --features test-redis run_examples: name: Run examples diff --git a/storages/mongo-storage/tests/mongo_indexes.rs b/storages/mongo-storage/tests/mongo_indexes.rs index 456ed018f..d295d002d 100644 --- a/storages/mongo-storage/tests/mongo_indexes.rs +++ b/storages/mongo-storage/tests/mongo_indexes.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-mongo")] + use { bson::{doc, Document}, gluesql_core::prelude::{Glue, Payload}, diff --git a/storages/mongo-storage/tests/mongo_storage.rs b/storages/mongo-storage/tests/mongo_storage.rs index da0cbb53e..9ae780537 100644 --- a/storages/mongo-storage/tests/mongo_storage.rs +++ b/storages/mongo-storage/tests/mongo_storage.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-mongo")] + use { async_trait::async_trait, gluesql_core::prelude::Glue, gluesql_mongo_storage::MongoStorage, test_suite::*, @@ -25,5 +27,4 @@ impl Tester for MongoTester { } } -#[cfg(feature = "test-mongo")] generate_store_tests!(tokio::test, MongoTester); diff --git a/storages/mongo-storage/tests/mongo_types.rs b/storages/mongo-storage/tests/mongo_types.rs index 3a2d6f824..16912ce95 100644 --- a/storages/mongo-storage/tests/mongo_types.rs +++ b/storages/mongo-storage/tests/mongo_types.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-mongo")] + use { bson::{doc, Bson}, gluesql_core::prelude::{Glue, Payload, Value}, diff --git a/storages/redis-storage/Cargo.toml b/storages/redis-storage/Cargo.toml index 4e31adae6..188007d1d 100644 --- a/storages/redis-storage/Cargo.toml +++ b/storages/redis-storage/Cargo.toml @@ -24,3 +24,6 @@ futures = "0.3" test-suite.workspace = true tokio = { version = "1", features = ["rt", "macros"] } toml = "0.8.6" + +[features] +test-redis = [] \ No newline at end of file diff --git a/storages/redis-storage/tests/redis_errors.rs b/storages/redis-storage/tests/redis_errors.rs index 152d8f41d..91adf92fb 100644 --- a/storages/redis-storage/tests/redis_errors.rs +++ b/storages/redis-storage/tests/redis_errors.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-redis")] + use { gluesql_core::prelude::{Error, Payload}, gluesql_redis_storage::RedisStorage, diff --git a/storages/redis-storage/tests/redis_reconnect.rs b/storages/redis-storage/tests/redis_reconnect.rs index 050f065b6..3f1079771 100644 --- a/storages/redis-storage/tests/redis_reconnect.rs +++ b/storages/redis-storage/tests/redis_reconnect.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-redis")] + use { gluesql_core::prelude::{Payload, Value}, gluesql_redis_storage::RedisStorage, diff --git a/storages/redis-storage/tests/redis_store.rs b/storages/redis-storage/tests/redis_store.rs index a8dd48496..99696ac89 100644 --- a/storages/redis-storage/tests/redis_store.rs +++ b/storages/redis-storage/tests/redis_store.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-redis")] + use { async_trait::async_trait, gluesql_core::prelude::Glue, @@ -51,9 +53,7 @@ impl Tester for RedisStorageTester { } generate_store_tests!(tokio::test, RedisStorageTester); - generate_alter_table_tests!(tokio::test, RedisStorageTester); - generate_metadata_table_tests!(tokio::test, RedisStorageTester); macro_rules! exec { diff --git a/storages/redis-storage/tests/redis_table.rs b/storages/redis-storage/tests/redis_table.rs index 055115b4d..1dd118287 100644 --- a/storages/redis-storage/tests/redis_table.rs +++ b/storages/redis-storage/tests/redis_table.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "test-redis")] + use { gluesql_core::prelude::{Glue, Payload, Value}, gluesql_redis_storage::RedisStorage,