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