-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-charts.sh
executable file
·48 lines (38 loc) · 1.27 KB
/
test-charts.sh
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
#!/bin/bash
# test-charts.sh
set -e
# Install prerequisites if not already installed
if ! helm plugin list | grep -q "unittest"; then
helm plugin install https://github.com/quintush/helm-unittest
else
echo "unittest plugin is already installed."
fi
# Run helm lint
echo "Running helm lint..."
helm lint charts/infra
helm lint charts/laravel-app
# Run unit tests
echo "Running unit tests..."
helm unittest charts/infra
helm unittest charts/laravel-app
# Create test cluster
echo "Creating test cluster..."
kind create cluster --name helm-testing
# Install cert-manager
echo "Installing cert-manager..."
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.3/cert-manager.yaml
kubectl wait --for=condition=Ready pods -n cert-manager --all --timeout=300s
# Install charts
echo "Installing charts..."
helm install infrastructure-test ./charts/infra \
-f charts/infra/values-staging.yaml \
-n infrastructure-staging --create-namespace
# Wait for deployments
echo "Waiting for deployments..."
kubectl wait --for=condition=Available deployments --all -n infrastructure-staging --timeout=300s
# Run tests
echo "Running helm test..."
helm test infrastructure-test -n infrastructure-staging
# Cleanup
echo "Cleaning up..."
kind delete cluster --name helm-testing