Skip to content

Commit

Permalink
chore: rename context to build context
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiKaiWi committed Mar 6, 2023
1 parent 0c9a27d commit 2f1c4a1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 35 deletions.
8 changes: 4 additions & 4 deletions analytic_engine/src/tests/alter_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ use crate::{
row_util,
table::{self, FixedSchemaTable},
util::{
EngineBuildContext, MemoryEngineBuildContext, Null, RocksDBEngineContext, TestContext,
TestEnv,
EngineBuildContext, MemoryEngineBuildContext, Null, RocksDBEngineBuildContext,
TestContext, TestEnv,
},
},
};

#[test]
fn test_alter_table_add_column_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_alter_table_add_column(rocksdb_ctx);
}

Expand Down Expand Up @@ -369,7 +369,7 @@ async fn check_read_row_group<T: EngineBuildContext>(

#[test]
fn test_alter_table_options_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_alter_table_options(rocksdb_ctx);
}

Expand Down
4 changes: 2 additions & 2 deletions analytic_engine/src/tests/compaction_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use table_engine::table::FlushRequest;
use crate::{
compaction::SizeTieredCompactionOptions,
tests::util::{
self, EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineContext, TestEnv,
self, EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineBuildContext, TestEnv,
},
};

#[test]
#[ignore = "https://github.com/CeresDB/ceresdb/issues/427"]
fn test_table_compact_current_segment_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_table_compact_current_segment(rocksdb_ctx);
}

Expand Down
16 changes: 9 additions & 7 deletions analytic_engine/src/tests/drop_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ use table_engine::table::AlterSchemaRequest;

use crate::tests::{
table::FixedSchemaTable,
util::{self, EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineContext, TestEnv},
util::{
self, EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineBuildContext, TestEnv,
},
};

#[test]
fn test_drop_table_once_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_drop_table_once(rocksdb_ctx);
}

Expand Down Expand Up @@ -57,7 +59,7 @@ fn test_drop_table_once<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_drop_table_again_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_drop_table_again(rocksdb_ctx);
}

Expand Down Expand Up @@ -94,7 +96,7 @@ fn test_drop_table_again<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_drop_create_table_mixed_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_drop_create_table_mixed(rocksdb_ctx);
}

Expand Down Expand Up @@ -207,7 +209,7 @@ fn test_drop_create_same_table_case<T: EngineBuildContext>(flush: bool, engine_c

#[test]
fn test_drop_create_same_table_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_drop_create_same_table(rocksdb_ctx);
}

Expand All @@ -225,7 +227,7 @@ fn test_drop_create_same_table<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_alter_schema_drop_create_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_alter_schema_drop_create(rocksdb_ctx);
}

Expand Down Expand Up @@ -282,7 +284,7 @@ fn test_alter_schema_drop_create<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_alter_options_drop_create_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_alter_options_drop_create(rocksdb_ctx);
}

Expand Down
4 changes: 2 additions & 2 deletions analytic_engine/src/tests/open_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
//! Engine open test.

use crate::tests::util::{
EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineContext, TestEnv,
EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineBuildContext, TestEnv,
};

#[test]
fn test_open_engine_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_open_engine(rocksdb_ctx);
}

Expand Down
18 changes: 9 additions & 9 deletions analytic_engine/src/tests/read_write_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ use table_engine::table::ReadOrder;
use crate::{
table_options,
tests::util::{
self, EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineContext, TestContext,
self, EngineBuildContext, MemoryEngineBuildContext, RocksDBEngineBuildContext, TestContext,
TestEnv,
},
};

#[test]
fn test_multi_table_read_write_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_multi_table_read_write(rocksdb_ctx);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ fn test_multi_table_read_write<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_table_write_read_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_table_write_read(rocksdb_ctx);
}

Expand Down Expand Up @@ -249,7 +249,7 @@ fn test_table_write_read<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_table_write_get_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_table_write_get(rocksdb_ctx);
}

Expand Down Expand Up @@ -326,7 +326,7 @@ fn test_table_write_get<T: EngineBuildContext>(engine_context: T) {

#[test]
fn test_table_write_get_override_rocks() {
test_table_write_get_override::<RocksDBEngineContext>();
test_table_write_get_override::<RocksDBEngineBuildContext>();
}

#[test]
Expand Down Expand Up @@ -505,7 +505,7 @@ fn test_table_write_get_override_case<T: EngineBuildContext>(

#[test]
fn test_db_write_buffer_size_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
// Use different table name to avoid metrics collision.
test_db_write_buffer_size("test_db_write_buffer_size_rocks", rocksdb_ctx);
}
Expand All @@ -526,7 +526,7 @@ fn test_db_write_buffer_size<T: EngineBuildContext>(table_name: &str, engine_con

#[test]
fn test_space_write_buffer_size_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
// Use different table name to avoid metrics collision.
test_space_write_buffer_size("test_space_write_buffer_size_rocks", rocksdb_ctx);
}
Expand Down Expand Up @@ -660,7 +660,7 @@ fn test_write_buffer_size_overflow<T: EngineBuildContext>(

#[test]
fn test_table_write_read_reverse_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_table_write_read_reverse(rocksdb_ctx);
}

Expand Down Expand Up @@ -746,7 +746,7 @@ fn test_table_write_read_reverse<T: EngineBuildContext>(engine_context: T) {
#[test]
#[ignore = "https://github.com/CeresDB/ceresdb/issues/313"]
fn test_table_write_read_reverse_after_flush_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_table_write_read_reverse_after_flush(rocksdb_ctx);
}

Expand Down
8 changes: 4 additions & 4 deletions analytic_engine/src/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,11 @@ pub trait EngineBuildContext: Clone + Default {
fn config(&self) -> Config;
}

pub struct RocksDBEngineContext {
pub struct RocksDBEngineBuildContext {
config: Config,
}

impl Default for RocksDBEngineContext {
impl Default for RocksDBEngineBuildContext {
fn default() -> Self {
let dir = tempfile::tempdir().unwrap();

Expand All @@ -489,7 +489,7 @@ impl Default for RocksDBEngineContext {
}
}

impl Clone for RocksDBEngineContext {
impl Clone for RocksDBEngineBuildContext {
fn clone(&self) -> Self {
let mut config = self.config.clone();

Expand All @@ -514,7 +514,7 @@ impl Clone for RocksDBEngineContext {
}
}

impl EngineBuildContext for RocksDBEngineContext {
impl EngineBuildContext for RocksDBEngineBuildContext {
type WalOpener = RocksDBWalsOpener;

fn wal_opener(&self) -> Self::WalOpener {
Expand Down
10 changes: 5 additions & 5 deletions catalog_impls/src/table_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ impl Schema for SchemaImpl {
mod tests {
use std::{collections::HashMap, sync::Arc};

use analytic_engine::tests::util::{EngineBuildContext, RocksDBEngineContext, TestEnv};
use analytic_engine::tests::util::{EngineBuildContext, RocksDBEngineBuildContext, TestEnv};
use catalog::{
consts::DEFAULT_CATALOG,
manager::Manager,
Expand Down Expand Up @@ -961,7 +961,7 @@ mod tests {

#[tokio::test]
async fn test_catalog_by_name_schema_by_name_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_catalog_by_name_schema_by_name(rocksdb_ctx).await;
}

Expand Down Expand Up @@ -1007,7 +1007,7 @@ mod tests {

#[tokio::test]
async fn test_maybe_create_schema_by_name_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_maybe_create_schema_by_name(rocksdb_ctx).await;
}

Expand Down Expand Up @@ -1039,7 +1039,7 @@ mod tests {

#[tokio::test]
async fn test_create_table_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_create_table(rocksdb_ctx).await;
}

Expand Down Expand Up @@ -1085,7 +1085,7 @@ mod tests {

#[tokio::test]
async fn test_drop_table_rocks() {
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_drop_table(rocksdb_ctx).await;
}

Expand Down
4 changes: 2 additions & 2 deletions interpreters/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::sync::Arc;

use analytic_engine::tests::util::{EngineBuildContext, RocksDBEngineContext, TestEnv};
use analytic_engine::tests::util::{EngineBuildContext, RocksDBEngineBuildContext, TestEnv};
use catalog::{
consts::{DEFAULT_CATALOG, DEFAULT_SCHEMA},
manager::ManagerRef,
Expand Down Expand Up @@ -337,7 +337,7 @@ where
#[tokio::test]
async fn test_interpreters_rocks() {
common_util::tests::init_log_for_test();
let rocksdb_ctx = RocksDBEngineContext::default();
let rocksdb_ctx = RocksDBEngineBuildContext::default();
test_interpreters(rocksdb_ctx).await;
}

Expand Down

0 comments on commit 2f1c4a1

Please sign in to comment.