Skip to content

Commit 937ebc7

Browse files
committed
fix(config): return error if --config file does not exist; fix test cases
1 parent 101a80e commit 937ebc7

7 files changed

Lines changed: 81 additions & 67 deletions

File tree

config/src/meta/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ impl Opt {
3939
let mut figment = Figment::new();
4040
// Merge toml config file.
4141
if let Some(path) = path {
42-
figment = figment.merge(Toml::file(path.as_ref()));
42+
let path = path.as_ref();
43+
if !path.exists() {
44+
return Err(figment::error::Kind::Message(format!(
45+
"Config file not found: {path:?}"
46+
))
47+
.into());
48+
}
49+
figment = figment.merge(Toml::file(path));
4350
}
4451
// Merge environment variables with prefix `CNOSDB_META_`.// Map field-keys into env-keys.
4552
let env_key_map = Self::env_keys();

config/src/tskv/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@ impl Config {
8989
let mut figment = Figment::new();
9090
// Merge toml config file.
9191
if let Some(path) = path {
92-
figment = figment.merge(Toml::file(path.as_ref()));
92+
let path = path.as_ref();
93+
if !path.exists() {
94+
return Err(figment::error::Kind::Message(format!(
95+
"Config file not found: {path:?}"
96+
))
97+
.into());
98+
}
99+
figment = figment.merge(Toml::file(path));
93100
}
94101
// Merge environment variables with prefix `CNOSDB_`.
95102
let env_key_map = Self::env_keys();

e2e_test/src/independent/replica_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use crate::utils::global::E2eContext;
1010
use crate::utils::Client;
1111
use crate::{check_response, cluster_def};
1212

13-
// const SERVER_URL: &str = "http://127.0.0.1:8902/api/v1/sql?db=replica_test_db";
14-
1513
fn replica_test(meta: Arc<TenantMeta>, server_url: &str) {
1614
let db_info = meta.get_db_info("replica_test_db").unwrap().unwrap();
1715
assert!(!db_info.buckets.is_empty());

main/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,14 @@ fn main() -> Result<(), std::io::Error> {
237237
});
238238
Ok(())
239239
}
240+
240241
fn handle_error<T, E: std::fmt::Debug>(result: Result<T, E>, context: &str) -> T {
241242
result.unwrap_or_else(|e| {
242243
error!("{}: {:?}", context, e);
243244
process::exit(1);
244245
})
245246
}
247+
246248
fn parse_config(run_args: &RunArgs) -> config::tskv::Config {
247249
println!("-----------------------------------------------------------");
248250
println!("Using Config File: {}\n", run_args.config);

query_server/sqllogicaltests/cases/function/gis/check_write.slt

Lines changed: 60 additions & 60 deletions
Large diffs are not rendered by default.

query_server/sqllogicaltests/cases/function/gis/st_distance.slt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ select st_distance('LINESTRING (30 10, 10 30, 40 40)', 'GEOMETRYCOLLECTION (POIN
112112

113113

114114

115-
query
115+
query
116116
select st_distance('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))', 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
117117
----
118118
0.0
119119

120-
query
120+
query
121121
select st_distance('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))', 'POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))');
122122
----
123123
0.0

query_server/sqllogicaltests/script/start_and_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PROJ_DIR=$(
2727

2828
META="${PROJ_DIR}/meta/scripts/cluster.sh"
2929
DATA="${PROJ_DIR}/main/scripts/cluster.sh"
30-
PROFILE='release'
30+
PROFILE='test-ci'
3131

3232
## Run cluster.
3333
CLUSTER_STARTED=0

0 commit comments

Comments
 (0)