Skip to content

Commit

Permalink
Failing test case for V1VerticalPodAutoscalerCrudTest (#3775)
Browse files Browse the repository at this point in the history
* Failing test case for V1VerticalPodAutoscalerCrudTest

* Fix existingJavaType for controlledResources in VPA extension

(cherry picked from commit bcfd4fd)
  • Loading branch information
matthyx authored and manusa committed Feb 4, 2022
1 parent 8ab32f9 commit 5ce2a73
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## CHANGELOG

### 5.12.1-SNAPSHOT

#### Bugs
* Fix #3776: VerticalPodAutoscaler cannot load yaml with "controlledResources"

### 5.12.0 (2022-01-24)

#### Bugs
Expand Down Expand Up @@ -33,14 +38,11 @@
* Fix #3234: Allow specifying specific localhost while port-forwarding
* Fix #3506: Add support for Open Cluster Management extension

#### _**Note**_: Breaking changes in the API

### 5.10.2 (2022-01-07)

#### Bugs
* Fix #3653: SnakeYAML uses only standard Java types


### 5.11.2 (2022-01-05)

#### Bugs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
// overwriting some times
manualTypeMap := map[reflect.Type]string{
reflect.TypeOf(metav1.Time{}): "java.lang.String",
reflect.TypeOf([]v1.ResourceName{}): "java.util.List<String>",
reflect.TypeOf([]v1.ResourceName{}): "java.lang.String",
reflect.TypeOf(apiextensionsv1.JSON{}): "com.fasterxml.jackson.databind.JsonNode",
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "array",
"javaOmitEmpty": true,
"items": {
"existingJavaType": "java.util.List\u003cString\u003e"
"existingJavaType": "java.lang.String"
}
},
"controlledValues": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,20 @@ void shouldLoadVerticalPodAutoscaler() {
" kind: Deployment",
" name: my-app",
" updatePolicy:",
" updateMode: \"Auto\""
" updateMode: \"Auto\"",
" resourcePolicy:",
" containerPolicies:",
" - containerName: container",
" controlledResources: [\"cpu\", \"memory\"]",
" controlledValues: RequestsOnly"
));
VerticalPodAutoscaler verticalPodAutoscaler = client.v1().verticalpodautoscalers().inNamespace("ns4").load(new ByteArrayInputStream(certificateDefinition.getBytes())).createOrReplace();
assertEquals("my-app-vpa", verticalPodAutoscaler.getMetadata().getName());
assertEquals("my-app", verticalPodAutoscaler.getSpec().getTargetRef().getName());
assertEquals("Auto", verticalPodAutoscaler.getSpec().getUpdatePolicy().getUpdateMode());
assertEquals("container", verticalPodAutoscaler.getSpec().getResourcePolicy().getContainerPolicies().get(0).getContainerName());
assertEquals(Arrays.asList("cpu", "memory"), verticalPodAutoscaler.getSpec().getResourcePolicy().getContainerPolicies().get(0).getControlledResources());
assertEquals("RequestsOnly", verticalPodAutoscaler.getSpec().getResourcePolicy().getContainerPolicies().get(0).getControlledValues());
}

}

0 comments on commit 5ce2a73

Please sign in to comment.