diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e8e1f2..74ebe127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Bob versions changelog #### Fixed +- Fix testmode launch prerequisites (#843) #### Updated diff --git a/bob-apps/bin/bobd.rs b/bob-apps/bin/bobd.rs index 5167c47b..b3fefbcf 100755 --- a/bob-apps/bin/bobd.rs +++ b/bob-apps/bin/bobd.rs @@ -83,16 +83,9 @@ async fn main() { }).expect("Node config parsing error"); check_folders(&node, matches.is_present("init_folders")); + initialize_logger(&node, &cluster); } - let mut extra_logstash_fields = HashMap::new(); - extra_logstash_fields.insert("node_name".to_string(), serde_json::Value::String(node.name().to_string())); - if let Some(cluster_node_info) = cluster.nodes().iter().find(|item| item.name() == node.name()) { - extra_logstash_fields.insert("node_address".to_string(), serde_json::Value::String(cluster_node_info.address().to_string())); - } - log4rs::init_file(node.log_config(), log4rs::config::Deserializers::default().with_logstash_extra(extra_logstash_fields)) - .expect("can't find log config"); - let mut mapper = VirtualMapper::new(&node, &cluster); let bind = node.bind(); @@ -198,9 +191,15 @@ fn configure_testmode(sub_matches: &ArgMatches) -> AnyResult<(ClusterConfig, Nod addresses.push(format!("127.0.0.1:{port}")) } let this_node_index = this_node.ok_or(anyhow!("current node address not found"))?; - let cluster = ClusterConfig::get_testmode( - sub_matches.value_of("data").unwrap_or(format!("data_{this_node_index}").as_str()).to_string(), - addresses)?; + let dir = match sub_matches.value_of("data") { + Some(d) => d.to_string(), + None => { + let dir = format!("data_{this_node_index}"); + create_dir(&dir)?; + dir + }, + }; + let cluster = ClusterConfig::get_testmode(dir, addresses)?; let http_api_port = match sub_matches.value_of("restapi-port") { Some(v) => Some(v.parse().context("could not parse --restapi-port")?), None => None @@ -344,6 +343,16 @@ fn spawn_signal_handler