Skip to content

Commit

Permalink
chore: add output path mapping e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoltzsche committed Jul 20, 2024
1 parent e96cde3 commit 7712122
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions e2e/kpt-krm-fn-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ teardown() {
grep -q cainjector ./output-remote.yaml
}

@test "kpt imperative fn should map output" {
cd example/kpt/output-mapping
rm -f output-default.yaml output-filtered.yaml
make fn

[ -f ./output-default.yaml ]
[ -f ./output-filtered.yaml ]
grep -q cainjector ./output-default.yaml
grep -Eq '^kind: ConfigMap$' ./output-filtered.yaml
! grep -Eq '^kind: ConfigMap$' ./output-default.yaml
}

@test "kpt declarative fn should render built-in chart" {
cd example/kpt/declarative
rm -rf generated
Expand Down
4 changes: 4 additions & 0 deletions example/kpt/output-mapping/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
IMAGE ?= mgoltzsche/khelm:latest

fn:
kpt fn eval --network --image="$(IMAGE)" --fn-config=./fn-config.yaml . --truncate-output=false
17 changes: 17 additions & 0 deletions example/kpt/output-mapping/fn-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: khelm.mgoltzsche.github.com/v2
kind: ChartRenderer
metadata:
name: remote-chart
annotations:
config.kubernetes.io/local-config: "true"
repository: https://charts.jetstack.io
chart: cert-manager
version: 1.10.2
name: myrelease
debug: true
outputPath: output-default.yaml
outputPathMapping:
- outputPath: output-filtered.yaml
selectors:
- kind: ConfigMap
name: myrelease-cert-manager-webhook

0 comments on commit 7712122

Please sign in to comment.