generator: test secure build relative base dir

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2022-05-23 11:32:24 +02:00
parent 87797221ac
commit db95625609
6 changed files with 44 additions and 0 deletions

View File

@ -50,3 +50,10 @@ func Test_secureBuildKustomization_panic(t *testing.T) {
g.Expect(err).To(HaveOccurred())
})
}
func Test_secureBuildKustomization_rel_basedir(t *testing.T) {
g := NewWithT(t)
_, err := secureBuildKustomization("testdata/relbase", "testdata/relbase/clusters/staging/flux-system", false)
g.Expect(err).ToNot(HaveOccurred())
}

View File

@ -0,0 +1,8 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cm
namespace: foo
data:
key: value

View File

@ -0,0 +1,5 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- configmap.yaml

View File

@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: secret
namespace: foo
stringData:
bar: foo

View File

@ -0,0 +1,8 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- secret.yaml
- ../../base
patchesStrategicMerge:
- ../../patches.yaml

View File

@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: secret
namespace: foo
stringData:
foo: bar