diff --git a/golem-test-framework/src/config/env.rs b/golem-test-framework/src/config/env.rs index 40f84f45c..e7e80a4e1 100644 --- a/golem-test-framework/src/config/env.rs +++ b/golem-test-framework/src/config/env.rs @@ -43,6 +43,7 @@ use crate::components::worker_service::docker::DockerWorkerService; use crate::components::worker_service::spawned::SpawnedWorkerService; use crate::components::worker_service::WorkerService; use crate::config::{DbType, TestDependencies}; +use once_cell::sync::Lazy; use tracing::Level; pub struct EnvBasedTestDependenciesConfig { @@ -153,7 +154,7 @@ pub struct EnvBasedTestDependencies { component_compilation_service: Arc, worker_service: Arc, worker_executor_cluster: Arc, - cassandra: Arc, + cassandra: Lazy>, } impl EnvBasedTestDependencies { @@ -411,8 +412,8 @@ impl EnvBasedTestDependencies { fn make_cassandra( _config: Arc, - ) -> Arc { - Arc::new(DockerCassandra::new(false)) + ) -> Lazy> { + Lazy::new(|| Arc::new(DockerCassandra::new(false))) } pub async fn new(config: EnvBasedTestDependenciesConfig) -> Self { diff --git a/golem-worker-executor-base/src/lib.rs b/golem-worker-executor-base/src/lib.rs index 9b50141b3..5fe1deacc 100644 --- a/golem-worker-executor-base/src/lib.rs +++ b/golem-worker-executor-base/src/lib.rs @@ -17,7 +17,6 @@ pub mod error; pub mod grpc; pub mod http_server; -pub mod cassandra; pub mod function_result_interpreter; pub mod invocation; pub mod metrics; @@ -65,7 +64,6 @@ use crate::storage::keyvalue::KeyValueStorage; use crate::workerctx::WorkerCtx; use anyhow::anyhow; use async_trait::async_trait; -use cassandra::CassandraSession; use golem_api_grpc::proto; use golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_server::WorkerExecutorServer; use golem_common::golem_version; @@ -74,6 +72,7 @@ use humansize::{ISizeFormatter, BINARY}; use nonempty_collections::NEVec; use prometheus::Registry; use std::sync::Arc; +use storage::cassandra::CassandraSession; use storage::keyvalue::cassandra::CassandraKeyValueStorage; use storage::keyvalue::sqlite::SqliteKeyValueStorage; use storage::sqlite_types::SqlitePool; diff --git a/golem-worker-executor-base/src/cassandra.rs b/golem-worker-executor-base/src/storage/cassandra.rs similarity index 100% rename from golem-worker-executor-base/src/cassandra.rs rename to golem-worker-executor-base/src/storage/cassandra.rs diff --git a/golem-worker-executor-base/src/storage/keyvalue/cassandra.rs b/golem-worker-executor-base/src/storage/keyvalue/cassandra.rs index eef49c10f..6c30354d7 100644 --- a/golem-worker-executor-base/src/storage/keyvalue/cassandra.rs +++ b/golem-worker-executor-base/src/storage/keyvalue/cassandra.rs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{ +use crate::storage::{ cassandra::CassandraSession, - storage::keyvalue::{KeyValueStorage, KeyValueStorageNamespace}, + keyvalue::{KeyValueStorage, KeyValueStorageNamespace}, }; use async_trait::async_trait; use bytes::Bytes; diff --git a/golem-worker-executor-base/src/storage/mod.rs b/golem-worker-executor-base/src/storage/mod.rs index 522dd2afa..c0e766e06 100644 --- a/golem-worker-executor-base/src/storage/mod.rs +++ b/golem-worker-executor-base/src/storage/mod.rs @@ -13,6 +13,7 @@ // limitations under the License. pub mod blob; +pub mod cassandra; pub mod indexed; pub mod keyvalue; pub mod sqlite_types; diff --git a/golem-worker-executor-base/tests/key_value_storage.rs b/golem-worker-executor-base/tests/key_value_storage.rs index 772f650ab..313ca6d5f 100644 --- a/golem-worker-executor-base/tests/key_value_storage.rs +++ b/golem-worker-executor-base/tests/key_value_storage.rs @@ -19,7 +19,7 @@ use golem_common::redis::RedisPool; use golem_test_framework::components::redis::Redis; use golem_test_framework::components::redis_monitor::RedisMonitor; use golem_test_framework::config::TestDependencies; -use golem_worker_executor_base::cassandra::CassandraSession; +use golem_worker_executor_base::storage::cassandra::CassandraSession; use golem_worker_executor_base::storage::keyvalue::cassandra::CassandraKeyValueStorage; use golem_worker_executor_base::storage::keyvalue::memory::InMemoryKeyValueStorage; use golem_worker_executor_base::storage::keyvalue::redis::RedisKeyValueStorage;