Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions helm/slurm-cluster/templates/slurm-scripts-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ data:
{{- if $conf.customContent }}
{{ tpl ($conf.customContent) $ | indent 4 }}
{{- else }}
{{ tpl (printf "slurm_scripts/%s" $name | $.Files.Get) $ | indent 4 }}
{{- $content := printf "slurm_scripts/%s" $name | $.Files.Get }}
{{- if not $content }}
{{- fail (printf "slurmScripts.builtIn.%s is enabled but no bundled script exists; remove this obsolete entry or set customContent" $name) }}
{{- end }}
{{ tpl $content $ | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
Expand All @@ -41,7 +45,11 @@ data:
{{- if $conf.customConfig }}
{{- $checks = append $checks (fromJson (tpl ($conf.customConfig) $)) }}
{{- else }}
{{- $checks = append $checks (fromJson (tpl (printf "slurm_scripts/%s.json" $name | $.Files.Get) $)) }}
{{- $config := printf "slurm_scripts/%s.json" $name | $.Files.Get }}
{{- if not $config }}
{{- fail (printf "slurmScripts.builtIn.%s is enabled but no bundled check configuration exists; remove this obsolete entry or set customConfig" $name) }}
{{- end }}
{{- $checks = append $checks (fromJson (tpl $config $)) }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
26 changes: 26 additions & 0 deletions helm/slurm-cluster/tests/slurm_scripts_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
suite: test Slurm scripts configuration
templates:
- slurm-scripts-cm.yaml
tests:
- it: should reject an enabled built-in without a bundled script
set:
slurmScripts:
builtIn:
removed_check.sh:
enabled: true
asserts:
- failedTemplate:
errorMessage: "slurmScripts.builtIn.removed_check.sh is enabled but no bundled script exists; remove this obsolete entry or set customContent"

- it: should reject an enabled built-in without a bundled check configuration
set:
slurmScripts:
builtIn:
removed_check.sh:
enabled: true
customContent: |-
#!/bin/bash
exit 0
asserts:
- failedTemplate:
errorMessage: "slurmScripts.builtIn.removed_check.sh is enabled but no bundled check configuration exists; remove this obsolete entry or set customConfig"
Loading