Skip to content

Commit

Permalink
[TEST] add failing test for trimming of if else
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Oct 7, 2023
1 parent 4b06019 commit 61776df
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions internal/adapter/yamlls/trimTemplate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,38 @@ metadata:
{documentText: `{{ $x := "test" }}`, trimmedText: ` `},
{documentText: `{{ /* comment */ }}`, trimmedText: ` `},
{documentText: `{{define "name"}} T1 {{end}}`, trimmedText: ` `},
{
documentText: `
{{- if .Values.controller.customStartupProbe }}
startupProbe: {}
{{- else if .Values.controller.startupProbe.enabled }}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.controller.containerPorts.controller }}
initialDelaySeconds: {{ .Values.controller.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.controller.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.controller.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.controller.startupProbe.successThreshold }}
failureThreshold: {{ .Values.controller.startupProbe.failureThreshold }}
{{- end }}
`,
trimmedText: `
startupProbe: {}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.controller.containerPorts.controller }}
initialDelaySeconds: {{ .Values.controller.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.controller.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.controller.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.controller.startupProbe.successThreshold }}
failureThreshold: {{ .Values.controller.startupProbe.failureThreshold }}
`,
},
}

func TestTrimTemplate(t *testing.T) {
Expand Down

0 comments on commit 61776df

Please sign in to comment.