Skip to content

Commit d4b0b38

Browse files
committed
Add negative tests of GOAWAY-chance
1 parent a08323d commit d4b0b38

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pkg/operator/configobservation/apiserver/observe_goaway_chance_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,30 @@ func TestObserveGoawayChance(t *testing.T) {
8888
"goaway-chance": []interface{}{"0"},
8989
}},
9090
},
91+
92+
// scenario 8 - Invalid goaway-chance value (negative)
93+
{
94+
name: "invalid: negative value",
95+
controlPlaneTopology: configv1.HighlyAvailableTopologyMode,
96+
existingKubeAPIConfig: map[string]interface{}{"apiServerArguments": map[string]interface{}{
97+
"goaway-chance": []interface{}{"-0.1"},
98+
}},
99+
expectedKubeAPIConfig: map[string]interface{}{"apiServerArguments": map[string]interface{}{
100+
"goaway-chance": []interface{}{"0.001"},
101+
}},
102+
},
103+
104+
// scenario 9 - Invalid goaway-chance value (greater than 0.2)
105+
{
106+
name: "invalid: value greater than 0.2",
107+
controlPlaneTopology: configv1.HighlyAvailableTopologyMode,
108+
existingKubeAPIConfig: map[string]interface{}{"apiServerArguments": map[string]interface{}{
109+
"goaway-chance": []interface{}{"0.3"},
110+
}},
111+
expectedKubeAPIConfig: map[string]interface{}{"apiServerArguments": map[string]interface{}{
112+
"goaway-chance": []interface{}{"0.001"},
113+
}},
114+
},
91115
}
92116

93117
for _, scenario := range scenarios {

0 commit comments

Comments
 (0)