Skip to content

Commit

Permalink
refactor: allow using without setup etcd
Browse files Browse the repository at this point in the history
  • Loading branch information
discord9 committed Dec 13, 2024
1 parent 5faa007 commit 3ebdb23
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/conf/metasrv-test.toml.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flush_stats_factor = 1
{{ if setup_etcd }}
{{ if use_etcd }}
## Store server address default to etcd store.
store_addrs = [{store_addrs | unescaped}]

Expand Down
17 changes: 8 additions & 9 deletions tests/runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ common-query.workspace = true
common-recordbatch.workspace = true
common-time.workspace = true
datatypes = { workspace = true }
flate2 = "1.0"
hex = "0.4"
local-ip-address = "0.6"
mysql = { version = "25.0.1", default-features = false, features = ["minimal", "rustls-tls"] }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
serde.workspace = true
serde_json.workspace = true
tokio-postgres = { workspace = true }
# sqlness 0.6.0 have a bug causing `cargo sqlness` to fail(see https://github.com/CeresDB/sqlness/issues/68) which is fixed in 0.6.1
flate2 = "1.0"
hex = "0.4.3"
local-ip-address = "0.6.3"
reqwest = { version = "0.12.9", default-features = false, features = ["rustls-tls"] }
sha2 = "=0.10.8"
sqlness = "0.6.1"
tar = "0.4.43"
sha2 = "0.10"
sqlness = "0.6.1" # sqlness 0.6.0 have a bug causing `cargo sqlness` to fail(see https://github.com/CeresDB/sqlness/issues/68) which is fixed in 0.6.1
tar = "0.4"
tempfile.workspace = true
tinytemplate = "1.2"
tokio.workspace = true
tokio-postgres = { workspace = true }
tokio-stream.workspace = true
6 changes: 3 additions & 3 deletions tests/runner/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl Env {
"-c".to_string(),
self.generate_config_file(subcommand, db_ctx),
];
if !db_ctx.store_config().setup_etcd {
if db_ctx.store_config().store_addrs.is_empty() {
args.extend(vec!["--backend".to_string(), "memory-store".to_string()])
}
(args, vec![METASRV_ADDR.to_string()])
Expand Down Expand Up @@ -586,7 +586,7 @@ impl Env {
procedure_dir: String,
is_raft_engine: bool,
kafka_wal_broker_endpoints: String,
setup_etcd: bool,
use_etcd: bool,
store_addrs: String,
}

Expand All @@ -601,7 +601,7 @@ impl Env {
procedure_dir,
is_raft_engine: db_ctx.is_raft_engine(),
kafka_wal_broker_endpoints: db_ctx.kafka_wal_broker_endpoints(),
setup_etcd: self.store_config.setup_etcd,
use_etcd: !self.store_config.store_addrs.is_empty(),
store_addrs: self
.store_config
.store_addrs
Expand Down
6 changes: 3 additions & 3 deletions tests/runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ struct Args {
#[clap(long, default_value = "true")]
pull_version_on_need: bool,

/// The store addresses for the raft engine.
#[clap(long, default_value = "0.0.0.0:2379")]
/// The store addresses for metadata, if empty, will use memory store.
#[clap(long)]
store_addrs: Vec<String>,

/// Whether to setup etcd, by default it is true.
/// Whether to setup etcd, by default it is false.
#[clap(long, default_value = "false")]
setup_etcd: bool,
}
Expand Down

0 comments on commit 3ebdb23

Please sign in to comment.