From f7941812a82b4dbb99ef5c878d81def84169f729 Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Fri, 3 Dec 2021 17:14:49 -0600 Subject: [PATCH] updated config_flags with pflags generation Signed-off-by: Daniel Rammer --- manager/config/config_flags.go | 1 + manager/config/config_flags_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/manager/config/config_flags.go b/manager/config/config_flags.go index 652af81ed..0e143f881 100755 --- a/manager/config/config_flags.go +++ b/manager/config/config_flags.go @@ -55,6 +55,7 @@ func (cfg Config) GetPFlagSet(prefix string) *pflag.FlagSet { cmdFlags.String(fmt.Sprintf("%v%v", prefix, "pod-template-name"), DefaultConfig.PodTemplateName, "K8s PodTemplate name to use for starting FlytePropeller pods") cmdFlags.String(fmt.Sprintf("%v%v", prefix, "pod-template-namespace"), DefaultConfig.PodTemplateNamespace, "Namespace where the k8s PodTemplate is located") cmdFlags.String(fmt.Sprintf("%v%v", prefix, "scan-interval"), DefaultConfig.ScanInterval.String(), "Frequency to scan FlytePropeller pods and start / restart if necessary") + cmdFlags.String(fmt.Sprintf("%v%v", prefix, "shard.type"), DefaultConfig.ShardConfig.Type.String(), "Shard implementation to use") cmdFlags.Int(fmt.Sprintf("%v%v", prefix, "shard.shard-count"), DefaultConfig.ShardConfig.ShardCount, "The number of shards to manage for a 'hash' shard type") return cmdFlags } diff --git a/manager/config/config_flags_test.go b/manager/config/config_flags_test.go index fcf0118de..887452276 100755 --- a/manager/config/config_flags_test.go +++ b/manager/config/config_flags_test.go @@ -169,6 +169,20 @@ func TestConfig_SetFlags(t *testing.T) { } }) }) + t.Run("Test_shard.type", func(t *testing.T) { + + t.Run("Override", func(t *testing.T) { + testValue := "1" + + cmdFlags.Set("shard.type", testValue) + if vString, err := cmdFlags.GetString("shard.type"); err == nil { + testDecodeJson_Config(t, fmt.Sprintf("%v", vString), &actual.ShardConfig.Type) + + } else { + assert.FailNow(t, err.Error()) + } + }) + }) t.Run("Test_shard.shard-count", func(t *testing.T) { t.Run("Override", func(t *testing.T) {