Repository navigation
Expand file tree
/
Copy pathquickstart_validation_test.sh
More file actions
executable file
·284 lines (238 loc) · 8.25 KB
/
Copy pathquickstart_validation_test.sh
File metadata and controls
executable file
·284 lines (238 loc) · 8.25 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
#!/bin/bash
# Quickstart Validation Test - Verify Horizon deployment guide
# Tests all steps in specs/002-horizon-full-compatibility/quickstart.md
set -e
echo "=== Quickstart Validation Test ==="
echo "Validating Horizon deployment guide"
echo ""
# Test environment
DOCKER_REQUIRED_VERSION="20.10"
DOCKER_COMPOSE_REQUIRED_VERSION="2.0"
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Success/failure tracking
TESTS_PASSED=0
TESTS_FAILED=0
pass() {
echo -e "${GREEN}✓${NC} $1"
((TESTS_PASSED++))
}
fail() {
echo -e "${RED}✗${NC} $1"
((TESTS_FAILED++))
}
# Step 1: Verify Prerequisites
echo "Step 1: Verify Prerequisites"
echo "-----------------------------"
# Check Docker
if command -v docker &> /dev/null; then
DOCKER_VERSION=$(docker --version | grep -oE '[0-9]+\.[0-9]+' | head -1)
if [[ $(echo "$DOCKER_VERSION >= $DOCKER_REQUIRED_VERSION" | bc) -eq 1 ]]; then
pass "Docker $DOCKER_VERSION installed (required: $DOCKER_REQUIRED_VERSION+)"
else
fail "Docker $DOCKER_VERSION too old (required: $DOCKER_REQUIRED_VERSION+)"
fi
else
fail "Docker not installed"
fi
# Check Docker Compose
if docker compose version &> /dev/null; then
COMPOSE_VERSION=$(docker compose version | grep -oE 'v[0-9]+\.[0-9]+' | head -1 | sed 's/v//')
if [[ $(echo "$COMPOSE_VERSION >= $DOCKER_COMPOSE_REQUIRED_VERSION" | bc) -eq 1 ]]; then
pass "Docker Compose $COMPOSE_VERSION installed (required: $DOCKER_COMPOSE_REQUIRED_VERSION+)"
else
fail "Docker Compose $COMPOSE_VERSION too old (required: $DOCKER_COMPOSE_REQUIRED_VERSION+)"
fi
else
fail "Docker Compose not installed"
fi
# Check disk space
AVAILABLE_SPACE=$(df -h . | awk 'NR==2 {print $4}' | sed 's/G//')
if [[ $(echo "$AVAILABLE_SPACE >= 10" | bc) -eq 1 ]]; then
pass "Disk space: ${AVAILABLE_SPACE}GB available (required: 10GB+)"
else
fail "Disk space: ${AVAILABLE_SPACE}GB available (required: 10GB+)"
fi
echo ""
# Step 2: Verify Lightstack Deployment
echo "Step 2: Verify Lightstack Deployment"
echo "------------------------------"
# Check if Lightstack is running
if docker ps | grep -q "lightstack"; then
pass "Lightstack container running"
else
fail "Lightstack container not running (run: docker compose -f deployments/docker-compose.yml up -d)"
fi
# Check if PostgreSQL is running
if docker ps | grep -q "postgres"; then
pass "PostgreSQL container running"
else
fail "PostgreSQL container not running"
fi
# Test Keystone endpoint
if curl -s -f http://localhost:35357/v3 > /dev/null; then
pass "Keystone endpoint accessible at http://localhost:35357/v3"
else
fail "Keystone endpoint not accessible"
fi
# Test authentication
export OS_AUTH_URL=http://localhost:35357/v3
export OS_USERNAME=admin
export OS_PASSWORD=secret
export OS_PROJECT_NAME=default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
if TOKEN=$(openstack token issue -f value -c id 2>/dev/null) && [ -n "$TOKEN" ]; then
pass "Authentication successful"
else
fail "Authentication failed"
fi
echo ""
# Step 3: Verify Service Catalog
echo "Step 3: Verify Service Catalog"
echo "-------------------------------"
# Check required services
REQUIRED_SERVICES=("identity" "compute" "network" "volume" "image")
for service in "${REQUIRED_SERVICES[@]}"; do
if openstack catalog show "$service" &> /dev/null; then
pass "Service catalog contains '$service'"
else
fail "Service catalog missing '$service'"
fi
done
echo ""
# Step 4: Verify API Endpoints
echo "Step 4: Verify API Endpoints"
echo "-----------------------------"
# Nova
if curl -s -f http://localhost:8774/v2.1 > /dev/null; then
pass "Nova endpoint accessible"
else
fail "Nova endpoint not accessible"
fi
# Neutron
if curl -s -f http://localhost:9696/v2.0 > /dev/null; then
pass "Neutron endpoint accessible"
else
fail "Neutron endpoint not accessible"
fi
# Cinder
if curl -s -f "http://localhost:8776/v3/$OS_PROJECT_NAME/volumes" -H "X-Auth-Token: $TOKEN" > /dev/null; then
pass "Cinder endpoint accessible"
else
fail "Cinder endpoint not accessible"
fi
# Glance
if curl -s -f http://localhost:9292/v2/images -H "X-Auth-Token: $TOKEN" > /dev/null; then
pass "Glance endpoint accessible"
else
fail "Glance endpoint not accessible"
fi
echo ""
# Step 5: Test Core Operations
echo "Step 5: Test Core Operations"
echo "-----------------------------"
# Test flavor list
if openstack flavor list > /dev/null 2>&1; then
FLAVOR_COUNT=$(openstack flavor list -f value | wc -l)
pass "Flavor list works ($FLAVOR_COUNT flavors available)"
else
fail "Flavor list failed"
fi
# Test image list
if openstack image list > /dev/null 2>&1; then
IMAGE_COUNT=$(openstack image list -f value | wc -l)
pass "Image list works ($IMAGE_COUNT images available)"
else
fail "Image list failed"
fi
# Test network list
if openstack network list > /dev/null 2>&1; then
NETWORK_COUNT=$(openstack network list -f value | wc -l)
pass "Network list works ($NETWORK_COUNT networks available)"
else
fail "Network list failed"
fi
# Test volume list
if openstack volume list > /dev/null 2>&1; then
VOLUME_COUNT=$(openstack volume list -f value | wc -l)
pass "Volume list works ($VOLUME_COUNT volumes available)"
else
fail "Volume list failed"
fi
echo ""
# Step 6: Verify Pagination Support
echo "Step 6: Verify Pagination Support"
echo "----------------------------------"
# Test Nova pagination
if curl -s -f "http://localhost:8774/v2.1/servers?limit=10" -H "X-Auth-Token: $TOKEN" > /dev/null; then
pass "Nova pagination supported (limit parameter)"
else
fail "Nova pagination not working"
fi
# Test Neutron pagination
if curl -s -f "http://localhost:9696/v2.0/networks?limit=10" -H "X-Auth-Token: $TOKEN" > /dev/null; then
pass "Neutron pagination supported (limit parameter)"
else
fail "Neutron pagination not working"
fi
# Test Cinder pagination
if curl -s -f "http://localhost:8776/v3/$OS_PROJECT_NAME/volumes?limit=10" -H "X-Auth-Token: $TOKEN" > /dev/null; then
pass "Cinder pagination supported (limit parameter)"
else
fail "Cinder pagination not working"
fi
# Test Glance pagination
if curl -s -f "http://localhost:9292/v2/images?limit=10" -H "X-Auth-Token: $TOKEN" > /dev/null; then
pass "Glance pagination supported (limit parameter)"
else
fail "Glance pagination not working"
fi
echo ""
# Step 7: Verify Database Indexes
echo "Step 7: Verify Database Indexes"
echo "--------------------------------"
# Check if migration 055 was applied
if docker exec lightstack-postgres psql -U lightstack -d lightstack -tAc "SELECT EXISTS(SELECT 1 FROM pg_indexes WHERE indexname = 'idx_instances_status');" | grep -q "t"; then
pass "Performance indexes applied (idx_instances_status exists)"
else
fail "Performance indexes not applied (migration 055 may not have run)"
fi
# Check database connection pool
if docker exec lightstack-postgres psql -U lightstack -d lightstack -tAc "SELECT count(*) FROM pg_stat_activity;" > /dev/null; then
ACTIVE_CONNECTIONS=$(docker exec lightstack-postgres psql -U lightstack -d lightstack -tAc "SELECT count(*) FROM pg_stat_activity;")
pass "Database connection pool active ($ACTIVE_CONNECTIONS connections)"
else
fail "Database connection pool check failed"
fi
echo ""
# Summary
echo "========================================="
echo "Test Summary"
echo "========================================="
echo -e "Passed: ${GREEN}$TESTS_PASSED${NC}"
echo -e "Failed: ${RED}$TESTS_FAILED${NC}"
echo ""
if [ $TESTS_FAILED -eq 0 ]; then
echo -e "${GREEN}✓ All tests passed!${NC}"
echo "Quickstart deployment guide is valid."
echo ""
echo "Next steps:"
echo "1. Deploy Horizon following quickstart.md Step 2"
echo "2. Access dashboard at http://localhost/dashboard"
echo "3. Login with admin/secret"
exit 0
else
echo -e "${RED}✗ Some tests failed.${NC}"
echo "Please fix the issues above before deploying Horizon."
echo ""
echo "Common fixes:"
echo "- Ensure Lightstack is running: docker compose -f deployments/docker-compose.yml up -d"
echo "- Wait for services to initialize (30-60 seconds)"
echo "- Run migrations: make migrate"
echo "- Check logs: docker compose -f deployments/docker-compose.yml logs"
exit 1
fi