forked from helm-unittest/helm-unittest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request helm-unittest#556 from gofogo/issue-555
issue-555: document selector defensive nil guard
- Loading branch information
Showing
19 changed files
with
305 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: document-selector | ||
version: 1.0.0 | ||
description: simple chart to validate different aspects of documentSelector | ||
keywords: | ||
- helm template test pkg/unittest/testdata/chart-document-selector --output-dir _scratch |
7 changes: 7 additions & 0 deletions
7
pkg/unittest/testdata/chart-document-selector/templates/cfg01.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{- if .Values.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: second-config-map | ||
{{- end}} | ||
|
5 changes: 5 additions & 0 deletions
5
pkg/unittest/testdata/chart-document-selector/templates/cfg02.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: second-cfg |
11 changes: 11 additions & 0 deletions
11
pkg/unittest/testdata/chart-document-selector/tests/case1-error_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
suite: document selector erroring first suite | ||
templates: | ||
- "*" | ||
tests: | ||
- it: partial document selector in asserts | ||
asserts: | ||
- exists: | ||
path: kind | ||
documentSelector: | ||
# this throw an error as currently documentSelector require path and value | ||
skipEmptyTemplates: true |
26 changes: 26 additions & 0 deletions
26
pkg/unittest/testdata/chart-document-selector/tests/case1-ok_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
suite: document selector currently working behaviour | ||
templates: | ||
- "*" | ||
tests: | ||
- it: assert selector to skip empty | ||
asserts: | ||
- exists: | ||
path: kind | ||
documentSelector: | ||
path: kind | ||
value: ConfigMap | ||
skipEmptyTemplates: true | ||
|
||
--- | ||
suite: document selector second suite | ||
templates: | ||
- "*" | ||
tests: | ||
- it: assert selector to skip empty | ||
documentSelector: | ||
path: kind | ||
value: ConfigMap | ||
skipEmptyTemplates: true | ||
asserts: | ||
- exists: | ||
path: kind |
13 changes: 13 additions & 0 deletions
13
pkg/unittest/testdata/chart-document-selector/tests/case2-error_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
suite: document selector erroring second suite | ||
templates: | ||
- "*.yaml" | ||
tests: | ||
- it: partial document selector in asserts. documentSelector.value is missing | ||
asserts: | ||
- exists: | ||
path: kind | ||
documentSelector: | ||
path: kind | ||
# this throw an error as currently documentSelector require path and value | ||
skipEmptyTemplates: true | ||
|
11 changes: 11 additions & 0 deletions
11
pkg/unittest/testdata/chart-document-selector/tests/case3-error_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
suite: document selector erroring | ||
templates: | ||
- "*.yaml" | ||
tests: | ||
- it: partial document selector in tests. documentSelector.skipEmptyTemplates is ignored | ||
documentSelector: | ||
skipEmptyTemplates: true | ||
asserts: | ||
# - asserts[0] exists fail Template document-selector/templates/cfg01.yaml Path kind expected to exists | ||
- exists: | ||
path: kind |
12 changes: 12 additions & 0 deletions
12
pkg/unittest/testdata/chart-document-selector/tests/case4-error_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
suite: document selector erroring second suite | ||
templates: | ||
- "*.yaml" | ||
tests: | ||
- it: partial document selector in asserts. documentSelector.value is missing | ||
asserts: | ||
- exists: | ||
path: kind | ||
documentSelector: | ||
# document selector is empty and ignored | ||
# current error is "Path: kind expected to exists" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.