Skip to content

Commit f92c189

Browse files
Update server/embed/config_test.go
Co-authored-by: Marek Siarkowicz <[email protected]>
1 parent c726d69 commit f92c189

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

server/embed/config_test.go

+7-17
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,14 @@ func TestConfigFileFeatureGates(t *testing.T) {
159159
t.Run(tc.name, func(t *testing.T) {
160160
var b []byte
161161
var err error
162-
if tc.setExperimentalStopGRPCServiceOnDefrag {
163-
yc := struct {
164-
ExperimentalStopGRPCServiceOnDefrag bool `json:"experimental-stop-grpc-service-on-defrag"`
165-
FeatureGatesJSON string `json:"feature-gates"`
166-
}{
167-
tc.experimentalStopGRPCServiceOnDefrag,
168-
tc.featureGatesJSON,
169-
}
170-
b, err = yaml.Marshal(&yc)
171-
} else {
172-
yc := struct {
173-
FeatureGatesJSON string `json:"feature-gates"`
174-
}{
175-
176-
tc.featureGatesJSON,
177-
}
178-
b, err = yaml.Marshal(&yc)
162+
data := map[string]string{}
163+
if tc.featureGatesJSON != "" {
164+
data["feature-gates"] = tc.featureGatesJSON
165+
}
166+
if tc.experimentalStopGRPCServiceOnDefrag != "" {
167+
data["experimental-stop-grpc-service-on-defrag"] = tc.experimentalStopGRPCServiceOnDefrag
179168
}
169+
b, err = yaml.Marshal(&yc)
180170
if err != nil {
181171
t.Fatal(err)
182172
}

0 commit comments

Comments
 (0)