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) }