Skip to content

Commit dfdd283

Browse files
committed
code review changes
1 parent e4f4e22 commit dfdd283

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

golem-test-framework/src/config/env.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use crate::components::worker_service::docker::DockerWorkerService;
4343
use crate::components::worker_service::spawned::SpawnedWorkerService;
4444
use crate::components::worker_service::WorkerService;
4545
use crate::config::{DbType, TestDependencies};
46+
use once_cell::sync::Lazy;
4647
use tracing::Level;
4748

4849
pub struct EnvBasedTestDependenciesConfig {
@@ -153,7 +154,7 @@ pub struct EnvBasedTestDependencies {
153154
component_compilation_service: Arc<dyn ComponentCompilationService + Send + Sync + 'static>,
154155
worker_service: Arc<dyn WorkerService + Send + Sync + 'static>,
155156
worker_executor_cluster: Arc<dyn WorkerExecutorCluster + Send + Sync + 'static>,
156-
cassandra: Arc<dyn Cassandra + Send + Sync + 'static>,
157+
cassandra: Lazy<Arc<dyn Cassandra + Send + Sync + 'static>>,
157158
}
158159

159160
impl EnvBasedTestDependencies {
@@ -411,8 +412,8 @@ impl EnvBasedTestDependencies {
411412

412413
fn make_cassandra(
413414
_config: Arc<EnvBasedTestDependenciesConfig>,
414-
) -> Arc<dyn Cassandra + Send + Sync + 'static> {
415-
Arc::new(DockerCassandra::new(false))
415+
) -> Lazy<Arc<dyn Cassandra + Send + Sync + 'static>> {
416+
Lazy::new(|| Arc::new(DockerCassandra::new(false)))
416417
}
417418

418419
pub async fn new(config: EnvBasedTestDependenciesConfig) -> Self {

golem-worker-executor-base/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub mod error;
1717
pub mod grpc;
1818
pub mod http_server;
1919

20-
pub mod cassandra;
2120
pub mod function_result_interpreter;
2221
pub mod invocation;
2322
pub mod metrics;
@@ -65,7 +64,6 @@ use crate::storage::keyvalue::KeyValueStorage;
6564
use crate::workerctx::WorkerCtx;
6665
use anyhow::anyhow;
6766
use async_trait::async_trait;
68-
use cassandra::CassandraSession;
6967
use golem_api_grpc::proto;
7068
use golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_server::WorkerExecutorServer;
7169
use golem_common::golem_version;
@@ -74,6 +72,7 @@ use humansize::{ISizeFormatter, BINARY};
7472
use nonempty_collections::NEVec;
7573
use prometheus::Registry;
7674
use std::sync::Arc;
75+
use storage::cassandra::CassandraSession;
7776
use storage::keyvalue::cassandra::CassandraKeyValueStorage;
7877
use storage::keyvalue::sqlite::SqliteKeyValueStorage;
7978
use storage::sqlite_types::SqlitePool;

golem-worker-executor-base/src/storage/keyvalue/cassandra.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use crate::{
15+
use crate::storage::{
1616
cassandra::CassandraSession,
17-
storage::keyvalue::{KeyValueStorage, KeyValueStorageNamespace},
17+
keyvalue::{KeyValueStorage, KeyValueStorageNamespace},
1818
};
1919
use async_trait::async_trait;
2020
use bytes::Bytes;

golem-worker-executor-base/src/storage/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
pub mod blob;
16+
pub mod cassandra;
1617
pub mod indexed;
1718
pub mod keyvalue;
1819
pub mod sqlite_types;

golem-worker-executor-base/tests/key_value_storage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use golem_common::redis::RedisPool;
1919
use golem_test_framework::components::redis::Redis;
2020
use golem_test_framework::components::redis_monitor::RedisMonitor;
2121
use golem_test_framework::config::TestDependencies;
22-
use golem_worker_executor_base::cassandra::CassandraSession;
22+
use golem_worker_executor_base::storage::cassandra::CassandraSession;
2323
use golem_worker_executor_base::storage::keyvalue::cassandra::CassandraKeyValueStorage;
2424
use golem_worker_executor_base::storage::keyvalue::memory::InMemoryKeyValueStorage;
2525
use golem_worker_executor_base::storage::keyvalue::redis::RedisKeyValueStorage;

0 commit comments

Comments
 (0)