-
Notifications
You must be signed in to change notification settings - Fork 11
/
cli-tests.bats
executable file
·50 lines (44 loc) · 1.5 KB
/
cli-tests.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bats
: ${IMAGE:=mgoltzsche/khelm:latest}
EXAMPLE_DIR="$(pwd)/example"
OUT_DIR="$(mktemp -d)"
teardown() {
rm -rf $OUT_DIR
}
@test "CLI should template remote chart without repositories.yaml" {
docker run --rm -u $(id -u):$(id -g) -v "$OUT_DIR:/out" "$IMAGE" template cert-manager \
--name=myrelease \
--version 1.0.4 \
--repo https://charts.jetstack.io \
--output /out/subdir/manifest.yaml \
--debug
ls -la $OUT_DIR/subdir
[ -f "$OUT_DIR/subdir/manifest.yaml" ]
grep -q myrelease "$OUT_DIR/subdir/manifest.yaml"
}
@test "CLI should output kustomization" {
docker run --rm -u $(id -u):$(id -g) -v "$OUT_DIR:/out" -v "$EXAMPLE_DIR/namespace:/chart" "$IMAGE" template /chart \
--output /out/kdir/ \
--debug
ls -la "$OUT_DIR" "$OUT_DIR/kdir" >&2
[ -f "$OUT_DIR/kdir/kustomization.yaml" ]
[ -f "$OUT_DIR/kdir/configmap_myconfigb.yaml" ]
}
@test "CLI should accept release name as argument" {
docker run --rm -u $(id -u):$(id -g) -v "$OUT_DIR:/out" "$IMAGE" template myreleasex cert-manager \
--version 1.0.4 \
--repo https://charts.jetstack.io \
--output /out/manifest.yaml \
--debug
[ -f "$OUT_DIR/manifest.yaml" ]
grep -q myreleasex "$OUT_DIR/manifest.yaml"
}
@test "CLI should support OCI registry" {
docker run --rm -u $(id -u):$(id -g) -v "$OUT_DIR:/out" "$IMAGE" \
template myreleasex oci://public.ecr.aws/karpenter/karpenter \
--version v0.27.0 \
--output /out/manifest.yaml \
--debug
[ -f "$OUT_DIR/manifest.yaml" ]
grep -q myreleasex "$OUT_DIR/manifest.yaml"
}