Commit 5b2a9414 authored by Martin Schurz's avatar Martin Schurz
Browse files

fix: adopt suggestions from code review

parent f9de627e
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ func TestCronjobMeta(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -161,7 +161,7 @@ func TestCronjobSchedule(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -219,7 +219,7 @@ func TestCronjobImage(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -354,7 +354,7 @@ func TestCronjobLivenessAndReadiness(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -415,7 +415,7 @@ func TestCronjobNodeSelector(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -499,7 +499,7 @@ func TestCronjobTolerations(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -572,7 +572,7 @@ func TestCronjobResources(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -660,7 +660,7 @@ func TestCronjobTemplateWithVolumeMounts(t *testing.T) {
				ValuesFiles: tc.valueFiles,
				SetValues:   tc.values,
			}
			output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -769,7 +769,7 @@ func TestCronjobAffinity(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -839,7 +839,7 @@ func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) {
			options := &helm.Options{
				SetValues: tc.values,
			}
			output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -873,7 +873,7 @@ func TestCronJobTemplateWithSecurityContext(t *testing.T) {
				SetValues: tc.values,
			}

			output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -909,7 +909,7 @@ func TestCronJobTemplateWithContainerSecurityContext(t *testing.T) {
				SetValues: tc.values,
			}

			output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -1011,7 +1011,7 @@ func TestCronjobImagePullSecrets(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
@@ -1101,7 +1101,7 @@ func TestCronjobPodAnnotations(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil)

			var cronjobs batchV1beta1.CronJobList
			helm.UnmarshalK8SYaml(t, output, &cronjobs)
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ func TestCustomResource(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{Template}, nil)

			var renderedObjects *unstructured.Unstructured
			helm.UnmarshalK8SYaml(t, output, &renderedObjects)
+3 −3
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ func TestInitializeDatabaseUrlEnvironmentVariable(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -151,7 +151,7 @@ func TestInitializeDatabaseImagePullSecrets(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -219,7 +219,7 @@ func TestInitializeDatabaseLabels(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
+3 −3
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ func TestMigrateDatabaseUrlEnvironmentVariable(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -151,7 +151,7 @@ func TestMigrateDatabaseImagePullSecrets(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -219,7 +219,7 @@ func TestMigrateDatabaseLabels(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
+56 −54
Original line number Diff line number Diff line
@@ -89,9 +89,12 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, tc.ExpectedErrorRegexp)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, tc.ExpectedErrorRegexp)

			if tc.ExpectedErrorRegexp != nil {
				return
            }
			
			if tc.ExpectedErrorRegexp == nil {
			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)

@@ -125,7 +128,6 @@ func TestDeploymentTemplate(t *testing.T) {
				"checksum/application-secrets": "",
			}, deployment.Spec.Template.Annotations)
			require.Equal(t, ExpectedLabels, deployment.Spec.Template.Labels)
			}
		})
	}

@@ -169,7 +171,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -221,7 +223,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -261,7 +263,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -339,7 +341,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -409,7 +411,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -462,7 +464,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -525,7 +527,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -574,7 +576,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -766,7 +768,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -828,7 +830,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -883,7 +885,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -947,7 +949,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -1154,7 +1156,7 @@ func TestDeploymentTemplate(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)
			output := mustRenderTemplate(t, options, tc.Release, []string{"templates/deployment.yaml"}, nil)

			var deployment appsV1.Deployment
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -1231,7 +1233,7 @@ func TestServiceExtraPortServicePortDefinition(t *testing.T) {
				ValuesFiles: tc.valueFiles,
				SetValues:   tc.values,
			}
			output := renderTemplate(t, opts, releaseName, templates, nil)
			output := mustRenderTemplate(t, opts, releaseName, templates, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, deployment)
@@ -1388,7 +1390,7 @@ func TestDeploymentTemplateWithVolumeMounts(t *testing.T) {
				ValuesFiles: tc.valueFiles,
				SetValues:   tc.values,
			}
			output := renderTemplate(t, opts, releaseName, templates, nil)
			output := mustRenderTemplate(t, opts, releaseName, templates, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, deployment)
@@ -1459,7 +1461,7 @@ func TestDeploymentDatabaseUrlEnvironmentVariable(t *testing.T) {
				KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
			}

			output := renderTemplate(t, options, releaseName, []string{tc.Template}, nil)
			output := mustRenderTemplate(t, options, releaseName, []string{tc.Template}, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, &deployment)
@@ -1531,7 +1533,7 @@ func TestDeploymentTemplateWithExtraEnvFrom(t *testing.T) {
			opts := &helm.Options{
				SetValues: tc.values,
			}
			output := renderTemplate(t, opts, releaseName, templates, nil)
			output := mustRenderTemplate(t, opts, releaseName, templates, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, deployment)
@@ -1567,7 +1569,7 @@ func TestDeploymentTemplateWithExtraEnv(t *testing.T) {
			opts := &helm.Options{
				SetValues: tc.values,
			}
			output := renderTemplate(t, opts, releaseName, templates, nil)
			output := mustRenderTemplate(t, opts, releaseName, templates, nil)

			deployment := new(appsV1.Deployment)
			helm.UnmarshalK8SYaml(t, output, deployment)
@@ -1599,7 +1601,7 @@ func TestDeploymentTemplateWithSecurityContext(t *testing.T) {
			opts := &helm.Options{
				SetValues: tc.values,
			}
			output := renderTemplate(t, opts, releaseName, templates, nil)
			output := mustRenderTemplate(t, opts, releaseName, templates, nil)

			deployment := new(appsV1.Deployment)

@@ -1634,7 +1636,7 @@ func TestDeploymentTemplateWithContainerSecurityContext(t *testing.T) {
			opts := &helm.Options{
				SetValues: tc.values,
			}
			output := renderTemplate(t, opts, releaseName, templates, nil)
			output := mustRenderTemplate(t, opts, releaseName, templates, nil)

			deployment := new(appsV1.Deployment)

Loading