test(gha-runner-scale-set): fix emptyDir tests to use ValuesFiles
(gha) Validate Helm Charts / Lint Chart (push) Has been cancelled
(gha) Validate Helm Charts / Test Chart (push) Has been cancelled

Replace SetValues with ValuesFiles for tests that use emptyDir: {}
to avoid Helm CLI's --set limitation that misparses object syntax.

- Create values_k8s_novolume_custom_volumes.yaml
- Create values_k8s_novolume_custom_volume_mounts.yaml
- Update WithCustomVolumes and WithCustomVolumeMounts tests

Fixes test failures introduced in previous commit.
This commit is contained in:
Nikola Jokic
2026-04-20 18:53:01 +02:00
parent f7c50cc9b2
commit c46200c06a
3 changed files with 41 additions and 23 deletions
@@ -1169,21 +1169,16 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesModeNoVolume_WithC
helmChartPath, err := filepath.Abs("../../gha-runner-scale-set")
require.NoError(t, err)
testValuesPath, err := filepath.Abs("../tests/values_k8s_novolume_custom_volumes.yaml")
require.NoError(t, err)
releaseName := "test-runners"
namespaceName := "test-" + strings.ToLower(random.UniqueId())
// Test that user-provided volumes are preserved even in kubernetes-novolume mode
options := &helm.Options{
Logger: logger.Discard,
SetValues: map[string]string{
"githubConfigUrl": "https://github.com/actions",
"githubConfigSecret.github_token": "gh_token12345",
"containerMode.type": "kubernetes-novolume",
"controllerServiceAccount.name": "arc",
"controllerServiceAccount.namespace": "arc-system",
"template.spec.volumes[0].name": "custom-volume",
"template.spec.volumes[0].emptyDir": "{}",
},
Logger: logger.Discard,
ValuesFiles: []string{testValuesPath},
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
}
@@ -1205,24 +1200,16 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesModeNoVolume_WithC
helmChartPath, err := filepath.Abs("../../gha-runner-scale-set")
require.NoError(t, err)
testValuesPath, err := filepath.Abs("../tests/values_k8s_novolume_custom_volume_mounts.yaml")
require.NoError(t, err)
releaseName := "test-runners"
namespaceName := "test-" + strings.ToLower(random.UniqueId())
// Test that user-provided volumeMounts are preserved in kubernetes-novolume runner container
options := &helm.Options{
Logger: logger.Discard,
SetValues: map[string]string{
"githubConfigUrl": "https://github.com/actions",
"githubConfigSecret.github_token": "gh_token12345",
"containerMode.type": "kubernetes-novolume",
"controllerServiceAccount.name": "arc",
"controllerServiceAccount.namespace": "arc-system",
"template.spec.volumes[0].name": "custom-volume",
"template.spec.volumes[0].emptyDir": "{}",
"template.spec.containers[0].name": "runner",
"template.spec.containers[0].volumeMounts[0].name": "custom-volume",
"template.spec.containers[0].volumeMounts[0].mountPath": "/mnt/custom",
},
Logger: logger.Discard,
ValuesFiles: []string{testValuesPath},
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
}
@@ -0,0 +1,18 @@
githubConfigUrl: https://github.com/actions
githubConfigSecret:
github_token: gh_token12345
containerMode:
type: kubernetes-novolume
controllerServiceAccount:
name: arc
namespace: arc-system
template:
spec:
volumes:
- name: custom-volume
emptyDir: {}
containers:
- name: runner
volumeMounts:
- name: custom-volume
mountPath: /mnt/custom
@@ -0,0 +1,13 @@
githubConfigUrl: https://github.com/actions
githubConfigSecret:
github_token: gh_token12345
containerMode:
type: kubernetes-novolume
controllerServiceAccount:
name: arc
namespace: arc-system
template:
spec:
volumes:
- name: custom-volume
emptyDir: {}