Skip to content

Commit 576bbcd

Browse files
committed
[WIP] Update deployment test - customCAcertificates
1 parent 0dc1639 commit 576bbcd

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

charts/test/unit/deployment_test.go

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package unit
55

66
import (
7+
"fmt"
78
"testing"
89

910
"github.com/gruntwork-io/terratest/modules/helm"
@@ -265,9 +266,44 @@ func TestDeploymentSecurityContext(t *testing.T) {
265266
assert.Equal(t, d, deployment)
266267
}
267268

269+
func TestDeploymentCustomCAcertificates(t *testing.T) {
270+
options := &helm.Options{
271+
Version: helmChartVersion,
272+
SetValues: map[string]string{
273+
"customCAcertificates": "SGVsbG8gV29ybGQ=",
274+
},
275+
}
276+
deployment := renderDeploymentManifest(t, options)
277+
d := defaultDeployment()
278+
279+
d.Spec.Template.Spec.Volumes = []corev1.Volume{
280+
{
281+
Name: "ca-certificates",
282+
VolumeSource: corev1.VolumeSource{
283+
ConfigMap: &corev1.ConfigMapVolumeSource{
284+
LocalObjectReference: corev1.LocalObjectReference{
285+
Name: fmt.Sprintf("%s-ca-certificates", helmReleaseName),
286+
},
287+
},
288+
},
289+
},
290+
}
291+
manager := d.Spec.Template.Spec.DeepCopy().Containers[0]
292+
manager.VolumeMounts = []corev1.VolumeMount{
293+
{
294+
Name: "ca-certificates",
295+
ReadOnly: true,
296+
MountPath: "/etc/ssl/certs/custom-ca-certificates.crt",
297+
SubPath: "ca-certificates",
298+
},
299+
}
300+
d.Spec.Template.Spec.Containers[0] = manager
301+
302+
assert.Equal(t, d, deployment)
303+
}
304+
268305
// TODO:
269306
// - customCAcertificates
270-
// - securityContext
271307
// - kubeRbacProxy.*
272308
// - operator.*
273309
// - controllers.*

0 commit comments

Comments
 (0)