From f92c1899ff716bf84a06a8859de46ada67c4ddb3 Mon Sep 17 00:00:00 2001 From: Siyuan Zhang <10984162+siyuanfoundation@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:36:38 -0700 Subject: [PATCH] Update server/embed/config_test.go Co-authored-by: Marek Siarkowicz --- server/embed/config_test.go | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/server/embed/config_test.go b/server/embed/config_test.go index 4d69e7a2f060..95e187306511 100644 --- a/server/embed/config_test.go +++ b/server/embed/config_test.go @@ -159,24 +159,14 @@ func TestConfigFileFeatureGates(t *testing.T) { t.Run(tc.name, func(t *testing.T) { var b []byte var err error - if tc.setExperimentalStopGRPCServiceOnDefrag { - yc := struct { - ExperimentalStopGRPCServiceOnDefrag bool `json:"experimental-stop-grpc-service-on-defrag"` - FeatureGatesJSON string `json:"feature-gates"` - }{ - tc.experimentalStopGRPCServiceOnDefrag, - tc.featureGatesJSON, - } - b, err = yaml.Marshal(&yc) - } else { - yc := struct { - FeatureGatesJSON string `json:"feature-gates"` - }{ - - tc.featureGatesJSON, - } - b, err = yaml.Marshal(&yc) + data := map[string]string{} + if tc.featureGatesJSON != "" { + data["feature-gates"] = tc.featureGatesJSON + } + if tc.experimentalStopGRPCServiceOnDefrag != "" { + data["experimental-stop-grpc-service-on-defrag"] = tc.experimentalStopGRPCServiceOnDefrag } + b, err = yaml.Marshal(&yc) if err != nil { t.Fatal(err) }