@@ -72,11 +72,10 @@ func TestValidateCapacity(t *testing.T) {
7272 errorSubstring : "invalid capacity value" ,
7373 },
7474 {
75- name : "invalid value of zero for capacity" ,
76- value : "0" ,
77- operator : placementv1beta1 .PropertySelectorGreaterThanOrEqualTo ,
78- wantError : true ,
79- errorSubstring : fmt .Sprintf ("capacity value cannot be below minimum %d after adjustment" , minVMInstanceCapacity ),
75+ name : "invalid value of zero for capacity replaced with minimum" ,
76+ value : "0" ,
77+ operator : placementv1beta1 .PropertySelectorGreaterThanOrEqualTo ,
78+ wantValue : 1 ,
8079 },
8180 {
8281 name : "capacity equal to max limit with GreaterThan operator" ,
@@ -86,12 +85,10 @@ func TestValidateCapacity(t *testing.T) {
8685 errorSubstring : "exceeds maximum allowed value" ,
8786 },
8887 {
89- name : "unsupported operator with capacity of 1" ,
90- value : "1" ,
91- operator : placementv1beta1 .PropertySelectorGreaterThanOrEqualTo ,
92- wantValue : 0 ,
93- wantError : true ,
94- errorSubstring : fmt .Sprintf ("capacity value cannot be below minimum %d after adjustment" , minVMInstanceCapacity ),
88+ name : "capacity at minimum limit with GreaterThanOrEqualTo operator" ,
89+ value : "1" ,
90+ operator : placementv1beta1 .PropertySelectorGreaterThanOrEqualTo ,
91+ wantValue : 1 ,
9592 },
9693 {
9794 name : "capacity equal to max limit with supported operator" ,
@@ -187,9 +184,8 @@ func TestExtractCapacityRequirements(t *testing.T) {
187184 Operator : placementv1beta1 .PropertySelectorGreaterThanOrEqualTo ,
188185 Values : []string {"1" },
189186 },
190- wantSKU : "Standard_B2ms" ,
191- wantError : true ,
192- errorSubstring : fmt .Sprintf ("capacity value cannot be below minimum %d after adjustment" , minVMInstanceCapacity ),
187+ wantSKU : "Standard_B2ms" ,
188+ wantCapacityValue : 1 ,
193189 },
194190 {
195191 name : "invalid Azure SKU capacity property with decimal" ,
@@ -421,18 +417,17 @@ func TestCheckIfMeetSKUCapacityRequirement(t *testing.T) {
421417 errorSubstring : "unsupported operator \" Eq\" for SKU capacity property, only GreaterThan (Gt) and GreaterThanOrEqualTo (Ge) are supported" ,
422418 },
423419 {
424- name : "invalid value in requirement" ,
420+ name : "too low value in requirement replaced with minimum capacity " ,
425421 cluster : cluster ,
426422 sku : validSKU ,
427- targetCapacity : 0 ,
423+ targetCapacity : 1 ,
428424 req : placementv1beta1.PropertySelectorRequirement {
429425 Name : fmt .Sprintf (azure .CapacityPerSKUPropertyTmpl , validSKU ),
430426 Operator : placementv1beta1 .PropertySelectorGreaterThanOrEqualTo ,
431427 Values : []string {"0" },
432428 },
433429 mockStatusCode : http .StatusOK ,
434- wantError : true ,
435- errorSubstring : fmt .Sprintf ("capacity value cannot be below minimum %d after adjustment" , minVMInstanceCapacity ),
430+ wantAvailable : true ,
436431 },
437432 {
438433 name : "cases-insensitive request - available SKU" ,
0 commit comments