Skip to content

Commit

Permalink
Fix sharding-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
irach-ramos committed Sep 23, 2024
1 parent 7114599 commit 2b407ac
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions golem-test-framework/src/config/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;

use crate::components;
use crate::components::cassandra::docker::DockerCassandra;
use crate::components::cassandra::Cassandra;
use crate::components::component_compilation_service::docker::DockerComponentCompilationService;
use crate::components::component_compilation_service::spawned::SpawnedComponentCompilationService;
Expand Down Expand Up @@ -80,7 +81,7 @@ impl EnvBasedTestDependenciesConfig {
self.keep_docker_containers = keep_docker_containers
}

if let Some(redis_port) = opt_env_var("REDIS_KEY_PREFIX") {
if let Some(redis_port) = opt_env_var("REDIS_PORT") {
self.redis_port = redis_port.parse().expect("Failed to parse REDIS_PORT");
}

Expand Down Expand Up @@ -152,6 +153,7 @@ pub struct EnvBasedTestDependencies {
component_compilation_service: Arc<dyn ComponentCompilationService + Send + Sync + 'static>,
worker_service: Arc<dyn WorkerService + Send + Sync + 'static>,
worker_executor_cluster: Arc<dyn WorkerExecutorCluster + Send + Sync + 'static>,
cassandra: Arc<dyn Cassandra + Send + Sync + 'static>,
}

impl EnvBasedTestDependencies {
Expand Down Expand Up @@ -407,6 +409,12 @@ impl EnvBasedTestDependencies {
}
}

fn make_cassandra(
_config: Arc<EnvBasedTestDependenciesConfig>,
) -> Arc<dyn Cassandra + Send + Sync + 'static> {
Arc::new(DockerCassandra::new(false))
}

pub async fn new(config: EnvBasedTestDependenciesConfig) -> Self {
let config = Arc::new(config);

Expand Down Expand Up @@ -462,6 +470,8 @@ impl EnvBasedTestDependencies {

let redis_monitor = redis_monitor_join.await.expect("Failed to join");

let cassandra = Self::make_cassandra(config.clone());

Self {
config: config.clone(),
rdb,
Expand All @@ -472,6 +482,7 @@ impl EnvBasedTestDependencies {
component_compilation_service,
worker_service,
worker_executor_cluster,
cassandra,
}
}
}
Expand Down Expand Up @@ -515,7 +526,7 @@ impl TestDependencies for EnvBasedTestDependencies {
self.worker_executor_cluster.clone()
}
fn cassandra(&self) -> Arc<dyn Cassandra + Send + Sync + 'static> {
panic!("Not supported")
self.cassandra.clone()
}
}

Expand Down

0 comments on commit 2b407ac

Please sign in to comment.