Add back tests for examples

Signed-off-by: Marco Franssen <[email protected]>
This commit is contained in:
Marco Franssen
2023-07-19 22:49:22 +02:00
parent 4b4cef1eae
commit 54ed71f969
11 changed files with 238 additions and 14 deletions
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -xe
SCRIPT="$(readlink -f "$0")"
SCRIPTPATH="$(dirname "${SCRIPT}")"
TESTDIR="${SCRIPTPATH}/../../.github/tests"
DEPS="${TESTDIR}/dependencies"
# shellcheck source=/dev/null
source "${SCRIPTPATH}/../../.github/scripts/parse-versions.sh"
# shellcheck source=/dev/null
source "${TESTDIR}/common.sh"
helm_install=(helm upgrade --install --create-namespace)
ns=spire-system
teardown() {
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true
helm uninstall --namespace mysql mysql 2>/dev/null || true
kubectl delete ns mysql 2>/dev/null || true
}
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT
"${helm_install[@]}" mysql mysql --version "$VERSION_MYSQL" --repo "$HELM_REPO_MYSQL" \
--namespace mysql \
--values "${DEPS}/mysql.yaml" \
--wait
"${helm_install[@]}" --namespace "${ns}" --values "${SCRIPTPATH}/values.yaml" \
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
helm test --namespace "${ns}" spire
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi
+3 -2
View File
@@ -2,7 +2,8 @@ spire-server:
dataStore:
sql:
databaseType: mysql
databaseName: spire
host: mysql
databaseName: spire-server
host: mysql.mysql
port: 3306
username: spire
# password: CHANGE_ME
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -xe
SCRIPT="$(readlink -f "$0")"
SCRIPTPATH="$(dirname "${SCRIPT}")"
TESTDIR="${SCRIPTPATH}/../../.github/tests"
DEPS="${TESTDIR}/dependencies"
# shellcheck source=/dev/null
source "${SCRIPTPATH}/../../.github/scripts/parse-versions.sh"
# shellcheck source=/dev/null
source "${TESTDIR}/common.sh"
helm_install=(helm upgrade --install --create-namespace)
ns=spire-system
teardown() {
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true
helm uninstall --namespace postgresql postgresql 2>/dev/null || true
kubectl delete ns postgresql 2>/dev/null || true
}
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT
"${helm_install[@]}" postgresql postgresql --version "$VERSION_POSTGRESQL" --repo "$HELM_REPO_POSTGRESQL" \
--namespace postgresql \
--values "${DEPS}/postgresql.yaml" \
--wait
"${helm_install[@]}" --namespace "${ns}" --values "${SCRIPTPATH}/values.yaml" \
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
helm test --namespace "${ns}" spire
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi
+3 -2
View File
@@ -2,9 +2,10 @@ spire-server:
dataStore:
sql:
databaseType: postgres
databaseName: spire
host: postgresql
databaseName: spire-server
host: postgresql.postgresql
port: 5432
username: spire
# password: CHANGE_ME
options:
- sslmode: disable
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -xe
SCRIPT="$(readlink -f "$0")"
SCRIPTPATH="$(dirname "${SCRIPT}")"
TESTDIR="${SCRIPTPATH}/../../.github/tests"
# shellcheck source=/dev/null
source "${TESTDIR}/common.sh"
helm_install=(helm upgrade --install --create-namespace)
ns=spire-server
teardown() {
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true
kubectl delete ns spire-system 2>/dev/null || true
}
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT
kubectl create namespace spire-system 2>/dev/null || true
kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true
kubectl create namespace "${ns}" 2>/dev/null || true
kubectl label namespace "${ns}" pod-security.kubernetes.io/enforce=restricted || true
"${helm_install[@]}" --namespace "${ns}" --values "${SCRIPTPATH}/values.yaml" --wait spire charts/spire
helm test --namespace "${ns}" spire
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -xe
SCRIPT="$(readlink -f "$0")"
SCRIPTPATH="$(dirname "${SCRIPT}")"
TESTDIR="${SCRIPTPATH}/../../.github/tests"
# shellcheck source=/dev/null
source "${TESTDIR}/common.sh"
helm_install=(helm upgrade --install --create-namespace)
ns=spire-system
teardown() {
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true
}
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT
"${helm_install[@]}" --namespace "${ns}" --values "${SCRIPTPATH}/values.yaml" --wait spire charts/spire
helm test --namespace "${ns}" spire
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi