-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix use of template functions declared in the same file
When using template functions that are declared in the same file as the templates, an error would be returned specifying that the function is not found. This commit fixes this behavior and also adds a test case that ensures that the bug has been fixed. Signed-off-by: Alina Sudakov <asudakov@redhat.com>
- Loading branch information
1 parent
8817fc8
commit 8b1a041
Showing
7 changed files
with
56 additions
and
1 deletion.
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
2 changes: 2 additions & 0 deletions
2
pkg/compare/testdata/RefContainsTemplatesWithFunctionTemplatesInSameFile/localerr.golden
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,2 @@ | ||
|
||
error code:1 |
23 changes: 23 additions & 0 deletions
23
pkg/compare/testdata/RefContainsTemplatesWithFunctionTemplatesInSameFile/localout.golden
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,23 @@ | ||
|
||
********************************** | ||
|
||
Cluster CR: v1_ConfigMap_kubernetes-dashboard_kubernetes-dashboard-settings | ||
Reference File: cm.yaml | ||
Diff Output: diff -u -N TEMP/v1_configmap_kubernetes-dashboard_kubernetes-dashboard-settings TEMP/v1_configmap_kubernetes-dashboard_kubernetes-dashboard-settings | ||
--- TEMP/v1_configmap_kubernetes-dashboard_kubernetes-dashboard-settings DATE | ||
+++ TEMP/v1_configmap_kubernetes-dashboard_kubernetes-dashboard-settings DATE | ||
@@ -2,6 +2,6 @@ | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
- k8s-app: kubernetes-dashboardfunction was called successfully from same file | ||
+ k8s-app: kubernetes-dashboard | ||
name: kubernetes-dashboard-settings | ||
namespace: kubernetes-dashboard | ||
|
||
********************************** | ||
|
||
Summary | ||
CRs with diffs: 1 | ||
No CRs are missing from the cluster | ||
No CRs are unmatched to reference CRs |
11 changes: 11 additions & 0 deletions
11
pkg/compare/testdata/RefContainsTemplatesWithFunctionTemplatesInSameFile/reference/cm.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 @@ | ||
{{- define "addBlob" -}} | ||
function was called successfully from same file | ||
{{- end -}} | ||
|
||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
k8s-app: kubernetes-dashboard {{- template "addBlob" }} | ||
name: kubernetes-dashboard-settings | ||
namespace: kubernetes-dashboard |
7 changes: 7 additions & 0 deletions
7
...pare/testdata/RefContainsTemplatesWithFunctionTemplatesInSameFile/reference/metadata.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 @@ | ||
Parts: | ||
- name: ExamplePart | ||
Components: | ||
- name: DemonSets | ||
type: Required | ||
requiredTemplates: | ||
- cm.yaml |
7 changes: 7 additions & 0 deletions
7
pkg/compare/testdata/RefContainsTemplatesWithFunctionTemplatesInSameFile/resources/cm.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 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
k8s-app: kubernetes-dashboard | ||
name: kubernetes-dashboard-settings | ||
namespace: kubernetes-dashboard |