From 2ea3b697016961b3e5b36a254fb1361f7ae4a3c4 Mon Sep 17 00:00:00 2001 From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com> Date: Wed, 15 Jun 2022 13:22:16 +0300 Subject: [PATCH] refactor: make cluster_id parameter optional Just supply it with a default value "demo". No new tests are necessary, we already have `test/int/test_joining.py::test_cluster_id_mismatch`. Close https://git.picodata.io/picodata/picodata/picodata/-/issues/96 --- src/args.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/args.rs b/src/args.rs index 6fce8296ed..abcd15ec04 100644 --- a/src/args.rs +++ b/src/args.rs @@ -22,8 +22,14 @@ pub enum Picodata { #[derive(Debug, Parser, tlua::Push, PartialEq)] #[clap(about = "Run the picodata instance")] pub struct Run { - #[clap(long, value_name = "name", env = "PICODATA_CLUSTER_ID")] - /// Name of the cluster + #[clap( + long, + value_name = "name", + default_value = "demo", + env = "PICODATA_CLUSTER_ID" + )] + /// Name of the cluster. The instance will refuse + /// to join a cluster with a different name. pub cluster_id: String, #[clap( @@ -268,7 +274,6 @@ mod tests { fn test_parse() { let _env_dump = EnvDump::new(); - std::env::set_var("PICODATA_CLUSTER_ID", "cluster1"); std::env::set_var("PICODATA_INSTANCE_ID", "instance-id-from-env"); std::env::set_var("PICODATA_PEER", "peer-from-env"); { -- GitLab