11package it .aboutbits .postgresql .helm ;
22
3+ import com .fasterxml .jackson .databind .JsonNode ;
34import io .fabric8 .kubernetes .api .model .ConfigBuilder ;
45import io .fabric8 .kubernetes .api .model .LocalObjectReference ;
56import io .fabric8 .kubernetes .api .model .Volume ;
67import io .fabric8 .kubernetes .api .model .VolumeMount ;
78import io .fabric8 .kubernetes .api .model .apps .Deployment ;
89import io .fabric8 .kubernetes .client .KubernetesClient ;
10+ import io .fabric8 .kubernetes .client .utils .KubernetesSerialization ;
911import io .fabric8 .kubernetes .client .utils .Serialization ;
1012import io .quarkus .test .junit .QuarkusTest ;
1113import io .smallrye .common .process .ProcessBuilder ;
3537@ NullMarked
3638class HelmTest {
3739 private static final String ENV_VAR_KUBECONFIG = "KUBECONFIG" ;
40+ private static final KubernetesSerialization KUBERNETES_SERIALIZATION = new KubernetesSerialization ();
3841
3942 /// The Pod and Container list fields that the chart exposes as free-form Helm values.
4043 private static final List <String > LIST_VALUES = List .of (
@@ -84,21 +87,19 @@ void helmInstall_createsDeployment() throws IOException {
8487 // 1. Verify files exist and contain expected data
8588 // ./Chart.yaml
8689 @ SuppressWarnings ("unchecked" )
87- Map <String , Object > chartMetadata = Serialization .yamlMapper ()
88- .readValue (
89- chartPath .resolve ("Chart.yaml" ).toFile (),
90- Map .class
91- );
90+ Map <String , Object > chartMetadata = KUBERNETES_SERIALIZATION .unmarshal (
91+ Files .newInputStream (chartPath .resolve ("Chart.yaml" )),
92+ Map .class
93+ );
9294
9395 assertThat (chartMetadata .get ("name" )).isEqualTo (chartName );
9496
9597 // ./values.yaml
9698 @ SuppressWarnings ("unchecked" )
97- Map <String , Object > values = Serialization .yamlMapper ()
98- .readValue (
99- chartPath .resolve ("values.yaml" ).toFile (),
100- Map .class
101- );
99+ Map <String , Object > values = KUBERNETES_SERIALIZATION .unmarshal (
100+ Files .newInputStream (chartPath .resolve ("values.yaml" )),
101+ Map .class
102+ );
102103
103104 assertThat (values ).containsKey (rootValuesAlias );
104105
@@ -123,8 +124,10 @@ void helmInstall_createsDeployment() throws IOException {
123124 // ./values.schema.json
124125 // The type must be declared for every list value, otherwise the generated schema
125126 // falls back to `string` and `helm install` rejects a list.
126- var valuesSchema = Serialization .jsonMapper ()
127- .readTree (chartPath .resolve ("values.schema.json" ).toFile ());
127+ var valuesSchema = KUBERNETES_SERIALIZATION .unmarshal (
128+ Files .newInputStream (chartPath .resolve ("values.schema.json" )),
129+ JsonNode .class
130+ );
128131
129132 for (var listValue : LIST_VALUES ) {
130133 var schemaProperty = valuesSchema .at ("/properties/%s/properties/%s" .formatted (
0 commit comments