@@ -2,7 +2,7 @@ name: Health Check
2
2
3
3
on :
4
4
push :
5
- branches : [ main ]
5
+ branches : [main]
6
6
7
7
jobs :
8
8
health-check :
@@ -111,49 +111,46 @@ jobs:
111
111
kill $APP_PID 2>/dev/null
112
112
echo "✅ Application starts and responds successfully"
113
113
114
- - name: Test Critical API Endpoints
115
- run : |
116
- echo "Testing critical API endpoints..."
117
-
118
- # Start the app in background
119
- yarn start &
120
- APP_PID=$!
121
- sleep 10
122
-
123
- # Test health check endpoint (if it exists)
124
- curl -f http://localhost:3000/api/health-check || echo "⚠️ Health check endpoint not found (optional)"
125
-
126
- # Test MQTT brokers endpoint
127
- curl -f http://localhost:3000/api/mqtt/brokers || {
128
- echo "❌ MQTT brokers API endpoint failed"
129
- kill $APP_PID 2>/dev/null
130
- exit 1
131
- }
132
-
133
- # Test plate-reads endpoint with test payload
134
- echo "Testing plate-reads endpoint with test payload..."
135
- curl -X POST \
136
- -H "Content-Type: application/json" \
137
- -d @test-payload.json \
138
- -f http://localhost:3000/api/plate-reads || {
139
- echo "❌ Plate-reads API endpoint failed with test payload"
114
+ - name : Test Critical API Endpoints
115
+ run : |
116
+ echo "Testing critical API endpoints..."
117
+
118
+ # Start the app in background
119
+ yarn start &
120
+ APP_PID=$!
121
+ sleep 10
122
+
123
+ # Test MQTT brokers endpoint
124
+ curl -f http://localhost:3000/api/mqtt/brokers || {
125
+ echo "❌ MQTT brokers API endpoint failed"
126
+ kill $APP_PID 2>/dev/null
127
+ exit 1
128
+ }
129
+
130
+ # Test plate-reads endpoint with test payload
131
+ echo "Testing plate-reads endpoint with test payload..."
132
+ curl -X POST \
133
+ -H "Content-Type: application/json" \
134
+ -d @test-payload.json \
135
+ -f http://localhost:3000/api/plate-reads || {
136
+ echo "❌ Plate-reads API endpoint failed with test payload"
137
+ kill $APP_PID 2>/dev/null
138
+ exit 1
139
+ }
140
+ echo "✅ Plate-reads endpoint processed test payload successfully"
141
+
142
+ # Verify the plate was actually processed (check database)
143
+ echo "Verifying plate data was processed..."
144
+ PLATE_COUNT=$(psql $DATABASE_URL -t -c "SELECT COUNT(*) FROM plate_reads WHERE plate_number IS NOT NULL;")
145
+ if [ "$PLATE_COUNT" -gt 0 ]; then
146
+ echo "✅ Plate data was successfully stored in database ($PLATE_COUNT records)"
147
+ else
148
+ echo "⚠️ No plate data found in database (may be expected for test payload)"
149
+ fi
150
+
151
+ # Cleanup
140
152
kill $APP_PID 2>/dev/null
141
- exit 1
142
- }
143
- echo "✅ Plate-reads endpoint processed test payload successfully"
144
-
145
- # Verify the plate was actually processed (check database)
146
- echo "Verifying plate data was processed..."
147
- PLATE_COUNT=$(psql $DATABASE_URL -t -c "SELECT COUNT(*) FROM plate_reads WHERE plate_number IS NOT NULL;")
148
- if [ "$PLATE_COUNT" -gt 0 ]; then
149
- echo "✅ Plate data was successfully stored in database ($PLATE_COUNT records)"
150
- else
151
- echo "⚠️ No plate data found in database (may be expected for test payload)"
152
- fi
153
-
154
- # Cleanup
155
- kill $APP_PID 2>/dev/null
156
- echo "✅ Critical API endpoints respond correctly"
153
+ echo "✅ Critical API endpoints respond correctly"
157
154
158
155
- name : Validate Configuration Files
159
156
run : |
0 commit comments