Skip to content

Commit

Permalink
chore: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
NiwakaDev committed Nov 16, 2023
1 parent 9cbd293 commit e18e7d8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions tests-integration/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct GreptimeDbClusterBuilder {
cluster_name: String,
kv_backend: KvBackendRef,
store_config: Option<ObjectStoreConfig>,
custom_store_types: Option<Vec<StorageType>>,
store_providers: Option<Vec<StorageType>>,
datanodes: Option<u32>,
}

Expand All @@ -69,7 +69,7 @@ impl GreptimeDbClusterBuilder {
cluster_name: cluster_name.to_string(),
kv_backend: Arc::new(MemoryKvBackend::new()),
store_config: None,
custom_store_types: None,
store_providers: None,
datanodes: None,
}
}
Expand All @@ -79,8 +79,8 @@ impl GreptimeDbClusterBuilder {
self
}

pub fn with_custom_store_types(mut self, store_types: Vec<StorageType>) -> Self {
self.custom_store_types = Some(store_types);
pub fn with_store_providers(mut self, store_providers: Vec<StorageType>) -> Self {
self.store_providers = Some(store_providers);
self
}

Expand Down Expand Up @@ -163,7 +163,7 @@ impl GreptimeDbClusterBuilder {
} else {
let (opts, guard) = create_tmp_dir_and_datanode_opts(
StorageType::File,
self.custom_store_types.clone().unwrap_or_default(),
self.store_providers.clone().unwrap_or_default(),
&format!("{}-dn-{}", self.cluster_name, datanode_id),
);

Expand Down
10 changes: 5 additions & 5 deletions tests-integration/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct GreptimeDbStandalone {

pub struct GreptimeDbStandaloneBuilder {
instance_name: String,
custom_store_types: Option<Vec<StorageType>>,
store_providers: Option<Vec<StorageType>>,
default_store: Option<StorageType>,
plugin: Option<Plugins>,
}
Expand All @@ -46,7 +46,7 @@ impl GreptimeDbStandaloneBuilder {
pub fn new(instance_name: &str) -> Self {
Self {
instance_name: instance_name.to_string(),
custom_store_types: None,
store_providers: None,
plugin: None,
default_store: None,
}
Expand All @@ -60,9 +60,9 @@ impl GreptimeDbStandaloneBuilder {
}

#[cfg(test)]
pub fn with_custom_store_types(self, store_types: Vec<StorageType>) -> Self {
pub fn with_store_providers(self, store_providers: Vec<StorageType>) -> Self {
Self {
custom_store_types: Some(store_types),
store_providers: Some(store_providers),
..self
}
}
Expand All @@ -77,7 +77,7 @@ impl GreptimeDbStandaloneBuilder {

pub async fn build(self) -> GreptimeDbStandalone {
let default_store_type = self.default_store.unwrap_or(StorageType::File);
let store_types = self.custom_store_types.unwrap_or_default();
let store_types = self.store_providers.unwrap_or_default();

let (opts, guard) =
create_tmp_dir_and_datanode_opts(default_store_type, store_types, &self.instance_name);
Expand Down
12 changes: 6 additions & 6 deletions tests-integration/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,26 +295,26 @@ impl TestGuard {

pub fn create_tmp_dir_and_datanode_opts(
default_store_type: StorageType,
custom_store_types: Vec<StorageType>,
store_provider_types: Vec<StorageType>,
name: &str,
) -> (DatanodeOptions, TestGuard) {
let home_tmp_dir = create_temp_dir(&format!("gt_data_{name}"));
let home_dir = home_tmp_dir.path().to_str().unwrap().to_string();

// Excludes the default object store.
let mut providers = Vec::with_capacity(custom_store_types.len());
let mut store_providers = Vec::with_capacity(store_provider_types.len());
// Includes the default object store.
let mut storage_guards = Vec::with_capacity(custom_store_types.len() + 1);
let mut storage_guards = Vec::with_capacity(store_provider_types.len() + 1);

let (default_store, data_tmp_dir) = get_test_store_config(&default_store_type);
storage_guards.push(StorageGuard(data_tmp_dir));

for store_type in custom_store_types {
for store_type in store_provider_types {
let (store, data_tmp_dir) = get_test_store_config(&store_type);
providers.push(store);
store_providers.push(store);
storage_guards.push(StorageGuard(data_tmp_dir))
}
let opts = create_datanode_opts(default_store, providers, home_dir);
let opts = create_datanode_opts(default_store, store_providers, home_dir);

(
opts,
Expand Down
6 changes: 3 additions & 3 deletions tests-integration/src/tests/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub(crate) async fn standalone_with_multiple_object_stores() -> Arc<dyn MockInst
let test_name = uuid::Uuid::new_v4().to_string();
let storage_types = StorageType::build_storage_types_based_on_env();
let instance = GreptimeDbStandaloneBuilder::new(&test_name)
.with_custom_store_types(storage_types)
.with_store_providers(storage_types)
.build()
.await;
Arc::new(instance)
Expand All @@ -77,9 +77,9 @@ pub(crate) async fn standalone_with_multiple_object_stores() -> Arc<dyn MockInst
pub(crate) async fn distributed_with_multiple_object_stores() -> Arc<dyn MockInstance> {
let _ = dotenv::dotenv();
let test_name = uuid::Uuid::new_v4().to_string();
let custom_storage_types = StorageType::build_storage_types_based_on_env();
let providers = StorageType::build_storage_types_based_on_env();
let cluster = GreptimeDbClusterBuilder::new(&test_name)
.with_custom_store_types(custom_storage_types)
.with_store_providers(providers)
.build()
.await;
Arc::new(MockDistributedInstance(cluster))
Expand Down

0 comments on commit e18e7d8

Please sign in to comment.