-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·79 lines (70 loc) · 2.44 KB
/
test.sh
File metadata and controls
executable file
·79 lines (70 loc) · 2.44 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
# Load common configuration
source "$(dirname "$0")/config.env"
echo "🧪 Testing ${PROJECT_NAME} setup..."
# Check if cluster exists
if ! kind get clusters | grep -q "$CLUSTER_NAME"; then
echo "❌ Kind cluster '$CLUSTER_NAME' not found. Run './setup.sh' first."
exit 1
fi
# Check kubectl context
if ! kubectl config current-context | grep -q "$KUBECTL_CONTEXT"; then
echo "⚠️ Setting kubectl context..."
kubectl config use-context "$KUBECTL_CONTEXT"
fi
# Check if Tiltfile exists and has basic syntax
echo "🔍 Checking Tiltfile..."
if [ ! -f "Tiltfile" ]; then
echo "❌ Tiltfile not found"
exit 1
fi
# Check if Tilt is already running
echo "🔍 Checking if Tilt is running..."
TILT_RUNNING=false
if lsof -ti:10350 > /dev/null 2>&1; then
TILT_RUNNING=true
echo "ℹ️ Tilt is already running on port 10350"
elif curl -s http://localhost:10350 > /dev/null 2>&1; then
TILT_RUNNING=true
echo "ℹ️ Tilt is already running on port 10350"
else
echo "✅ Tilt is not running - ready for 'tilt up'"
fi
# Validate Tiltfile syntax using tilt ci with short timeout (only if Tilt is not running)
if [ "$TILT_RUNNING" = false ]; then
echo "🔍 Validating Tiltfile syntax..."
if tilt ci --timeout=2s > /dev/null 2>&1; then
echo "✅ Tiltfile syntax is valid"
elif tilt ci --timeout=2s 2>&1 | grep -q "Loading Tiltfile"; then
echo "✅ Tiltfile syntax is valid (loaded successfully)"
else
echo "❌ Tiltfile has syntax errors. Run 'tilt ci --timeout=5s' for details."
exit 1
fi
else
echo "⏭️ Skipping Tiltfile validation (Tilt already running)"
fi
# Check if required tools are available
echo "🔍 Checking required tools..."
for tool in kind kubectl tilt; do
if command -v "$tool" &> /dev/null; then
echo "✅ $tool is installed"
else
echo "❌ $tool is not installed"
exit 1
fi
done
# Provide appropriate next steps based on Tilt status
echo ""
if [ "$TILT_RUNNING" = true ]; then
echo "✅ All checks passed! Tilt is already running."
echo "🌐 Access the Tilt UI at: http://localhost:10350"
echo "📊 Access Grafana at: http://localhost:3000 (admin/admin)"
echo ""
echo "💡 Next steps:"
echo " - Open http://localhost:10350 to see Tilt status"
echo " - If you need to restart Tilt, run 'tilt down' first, then 'tilt up'"
else
echo "✅ All checks passed! You can now run 'tilt up'"
fi