This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/tests/test-stdlib.sh
Tom Chauveau 32d523aa71 tests(stdlib/k8s/helm): test basic helm chart
tests(stdlib/k8s/helm): add verification
style(tests/): rename helper into verify to confirm that deployments works

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-04-15 14:24:42 +02:00

32 lines
1.4 KiB
Bash

#!/usr/bin/env bash
set -o errexit -o errtrace -o functrace -o nounset -o pipefail
# Test Directory
d=$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd)
test::stdlib(){
local dagger="$1"
test::one "stdlib: alpine" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/alpine
test::one "stdlib: react" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/js/react --input-dir TestData="$d"/stdlib/js/react/testdata
test::one "stdlib: go" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/go --input-dir TestData="$d"/stdlib/go/testdata
test::one "stdlib: file" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/file
test::secret "$d"/stdlib/netlify/inputs.yaml "stdlib: netlify" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/netlify
# Check if there is a kubeconfig and if it for a kind cluster
if [ -f ~/.kube/config ] && grep -q "kind" ~/.kube/config &> /dev/null; then
test::one "stdlib: kubernetes" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/kubernetes --input-dir kubeconfig=~/.kube
test::one "stdlib: helm" \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/kubernetes/helm --input-dir kubeconfig=~/.kube --input-dir TestHelmSimpleChart.deploy.chartSource="$d"/stdlib/kubernetes/helm/testdata/mychart
else
logger::warning "Skip kubernetes test: local cluster not available"
fi
}