Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for including ephemeral storage requirement to the install job. #791

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions terratest/src/test/pega/pega-installer-job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,54 @@ func assertJob(t *testing.T, jobYaml string, expectedJob pegaDbJob, options *hel
require.Equal(t, expectedJob.initContainers, actualInitContainerNames)
VerifyInitContainerData(t, actualInitContainers, options)
}

func TestPegaInstallerJobResourcesWithEphemeralStorage(t *testing.T) {
var options = &helm.Options{
SetValues: map[string]string{
"global.deployment.name": "pega",
"global.provider": "k8s",
"global.actions.execute": "install",
"installer.resources.requests.ephemeralStorage": "10Gi",
"installer.resources.limits.ephemeralStorage": "11Gi",
"installer.imagePullPolicy": "Always",
},
}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)

yamlContent := RenderTemplate(t, options, helmChartPath, []string{"charts/installer/templates/pega-installer-job.yaml"})
yamlSplit := strings.Split(yamlContent, "---")

var jobObj k8sbatch.Job
UnmarshalK8SYaml(t, yamlSplit[1], &jobObj)

require.Equal(t, "11Gi", jobObj.Spec.Template.Spec.Containers[0].Resources.Limits.StorageEphemeral().String())
require.Equal(t, "10Gi", jobObj.Spec.Template.Spec.Containers[0].Resources.Requests.StorageEphemeral().String())
}



func TestPegaInstallerJobResourcesWithNoEphemeralStorage(t *testing.T) {
var options = &helm.Options{
SetValues: map[string]string{
"global.deployment.name": "pega",
"global.provider": "k8s",
"global.actions.execute": "install",
"installer.imagePullPolicy": "Always",
},
}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)

yamlContent := RenderTemplate(t, options, helmChartPath, []string{"charts/installer/templates/pega-installer-job.yaml"})
yamlSplit := strings.Split(yamlContent, "---")

var jobObj k8sbatch.Job
UnmarshalK8SYaml(t, yamlSplit[1], &jobObj)

require.Equal(t, "0", jobObj.Spec.Template.Spec.Containers[0].Resources.Limits.StorageEphemeral().String())
require.Equal(t, "0", jobObj.Spec.Template.Spec.Containers[0].Resources.Requests.StorageEphemeral().String())

}
Loading