File tree 1 file changed +19
-0
lines changed
vertical-pod-autoscaler/pkg/admission-controller/resource/vpa 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ func TestValidateVPA(t *testing.T) {
37
37
badScalingMode := vpa_types .ContainerScalingMode ("bad" )
38
38
badCPUResource := resource .MustParse ("187500u" )
39
39
validScalingMode := vpa_types .ContainerScalingModeAuto
40
+ scalingModeOff := vpa_types .ContainerScalingModeOff
41
+ controlledValuesRequestsAndLimits := vpa_types .ContainerControlledValuesRequestsAndLimits
40
42
tests := []struct {
41
43
name string
42
44
vpa vpa_types.VerticalPodAutoscaler
@@ -164,6 +166,23 @@ func TestValidateVPA(t *testing.T) {
164
166
},
165
167
expectError : fmt .Errorf ("MaxAllowed: Memory [%v] must be a whole number of bytes" , resource .MustParse ("500m" )),
166
168
},
169
+ {
170
+ name : "scaling off with controlled values requests and limits" ,
171
+ vpa : vpa_types.VerticalPodAutoscaler {
172
+ Spec : vpa_types.VerticalPodAutoscalerSpec {
173
+ ResourcePolicy : & vpa_types.PodResourcePolicy {
174
+ ContainerPolicies : []vpa_types.ContainerResourcePolicy {
175
+ {
176
+ ContainerName : "loot box" ,
177
+ Mode : & scalingModeOff ,
178
+ ControlledValues : & controlledValuesRequestsAndLimits ,
179
+ },
180
+ },
181
+ },
182
+ },
183
+ },
184
+ expectError : fmt .Errorf ("ControlledValues shouldn't be specified if container scaling mode is off." ),
185
+ },
167
186
{
168
187
name : "all valid" ,
169
188
vpa : vpa_types.VerticalPodAutoscaler {
You can’t perform that action at this time.
0 commit comments