Skip to content

Commit 735cf91

Browse files
committed
Resolve actions errors
1 parent 4292bc2 commit 735cf91

File tree

2 files changed

+83
-69
lines changed

2 files changed

+83
-69
lines changed

.github/workflows/test.yaml

Lines changed: 81 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -142,127 +142,137 @@ jobs:
142142
run: |
143143
# Test that test utilities can be sourced without errors
144144
echo "Testing test utilities..."
145-
145+
146146
# Source test utilities and test basic functions
147147
source scripts/test-utils.sh
148-
148+
149149
# Test that functions are available
150150
if ! type test_router_health > /dev/null 2>&1; then
151151
echo "❌ test_router_health function not found"
152152
exit 1
153153
fi
154-
154+
155155
if ! type test_search_products > /dev/null 2>&1; then
156156
echo "❌ test_search_products function not found"
157157
exit 1
158158
fi
159-
159+
160160
if ! type test_router_comprehensive > /dev/null 2>&1; then
161161
echo "❌ test_router_comprehensive function not found"
162162
exit 1
163163
fi
164-
164+
165165
echo "✅ Test utilities functions available"
166-
166+
167167
# Test that test utilities can be run directly
168168
echo "Testing test utilities execution..."
169-
169+
170170
# Test that the script can be run with --help (should show usage)
171-
if ! bash scripts/test-utils.sh --help 2>&1 | grep -q "Available tests"; then
171+
if ! bash scripts/test-utils.sh --help 2>&1 | \
172+
grep -q "Available tests"; then
172173
echo "❌ test-utils.sh --help not working correctly"
173174
exit 1
174175
fi
175-
176+
176177
echo "✅ Test utilities execution working"
177178
178179
- name: Test script organization
179180
run: |
180181
echo "🔍 Dynamically discovering scripts..."
181-
182+
182183
# Discover user-facing scripts in root directory
183184
echo "📁 Checking user-facing scripts in root directory..."
184-
user_scripts=($(find . -maxdepth 1 -name "*.sh" -type f -exec basename {} \; | grep -v "^\.$"))
185-
185+
user_scripts=($(find . -maxdepth 1 -name "*.sh" -type f \
186+
-exec basename {} \; | grep -v "^\.$"))
187+
186188
if [ ${#user_scripts[@]} -eq 0 ]; then
187189
echo "❌ No user-facing scripts found in root directory"
188190
exit 1
189191
fi
190-
192+
191193
echo "✅ Found ${#user_scripts[@]} user-facing scripts:"
192194
for script in "${user_scripts[@]}"; do
193195
echo " - $script"
194196
done
195-
197+
196198
# Discover internal scripts in scripts directory
197199
echo "📁 Checking internal scripts in scripts directory..."
198200
if [ ! -d "scripts" ]; then
199201
echo "❌ scripts directory not found"
200202
exit 1
201203
fi
202-
203-
internal_scripts=($(find scripts -name "*.sh" -type f -exec basename {} \;))
204-
204+
205+
internal_scripts=($(find scripts -name "*.sh" -type f \
206+
-exec basename {} \;))
207+
205208
if [ ${#internal_scripts[@]} -eq 0 ]; then
206209
echo "❌ No internal scripts found in scripts directory"
207210
exit 1
208211
fi
209-
212+
210213
echo "✅ Found ${#internal_scripts[@]} internal scripts:"
211214
for script in "${internal_scripts[@]}"; do
212215
echo " - scripts/$script"
213216
done
214-
217+
215218
echo "✅ Script organization is correct"
216-
219+
217220
# Test that scripts are using test utilities (no duplication)
218221
echo "Testing for script duplication..."
219-
220-
# Check all scripts for hardcoded curl commands that should use test utilities
222+
223+
# Check all scripts for hardcoded curl commands that should use test
224+
# utilities
221225
echo "🔍 Checking for hardcoded curl commands in scripts..."
222-
226+
223227
# Check user-facing scripts
224228
for script in "${user_scripts[@]}"; do
225229
if grep -q "curl.*localhost:4000" "$script"; then
226-
echo "❌ $script contains hardcoded curl commands for router testing"
230+
echo "❌ $script contains hardcoded curl commands for router \
231+
testing"
227232
echo " Should use test utilities instead"
228233
exit 1
229234
fi
230235
done
231-
232-
# Check internal scripts (but allow some curl usage in test-utils.sh itself)
236+
237+
# Check internal scripts (but allow some curl usage in test-utils.sh
238+
# itself)
233239
for script in "${internal_scripts[@]}"; do
234-
if [ "$script" != "test-utils.sh" ] && grep -q "curl.*localhost:4000.*health" "scripts/$script"; then
235-
echo "❌ scripts/$script contains hardcoded curl commands for health checks"
240+
if [ "$script" != "test-utils.sh" ] && \
241+
grep -q "curl.*localhost:4000.*health" "scripts/$script"; then
242+
echo "❌ scripts/$script contains hardcoded curl commands for \
243+
health checks"
236244
echo " Should use test utilities instead"
237245
exit 1
238246
fi
239247
done
240-
241-
echo "✅ No duplication found - scripts using test utilities correctly"
242-
248+
249+
echo "✅ No duplication found - scripts using test utilities \
250+
correctly"
251+
243252
# Test that test utilities contain expected functions
244253
echo "Testing test utilities content..."
245-
254+
246255
# Check that test-utils.sh exists
247256
if [ ! -f "scripts/test-utils.sh" ]; then
248257
echo "❌ test-utils.sh not found in scripts directory"
249258
exit 1
250259
fi
251-
260+
252261
# Discover test functions dynamically
253262
echo "🔍 Discovering test functions in test-utils.sh..."
254-
test_functions=($(grep -E "^test_[a-zA-Z_]+\(\)" scripts/test-utils.sh | sed 's/() {.*//' | sort))
255-
263+
test_functions=($(grep -E "^test_[a-zA-Z_]+\(\)" \
264+
scripts/test-utils.sh | sed 's/() {.*//' | sort))
265+
256266
if [ ${#test_functions[@]} -eq 0 ]; then
257267
echo "❌ No test functions found in test-utils.sh"
258268
exit 1
259269
fi
260-
270+
261271
echo "✅ Found ${#test_functions[@]} test functions:"
262272
for func in "${test_functions[@]}"; do
263273
echo " - $func"
264274
done
265-
275+
266276
# Check for essential test functions
267277
essential_functions=("test_router_health" "test_search_products")
268278
for func in "${essential_functions[@]}"; do
@@ -271,38 +281,40 @@ jobs:
271281
exit 1
272282
fi
273283
done
274-
284+
275285
echo "✅ Test utilities contain essential functions"
276-
286+
277287
# Test that test-router.sh works correctly
278288
echo "Testing test-router.sh functionality..."
279-
289+
280290
# Check that test-router.sh exists
281291
if [ ! -f "test-router.sh" ]; then
282292
echo "❌ test-router.sh not found in root directory"
283293
exit 1
284294
fi
285-
295+
286296
# Test that it can show help
287297
if ! ./test-router.sh --help 2>&1 | grep -q "Test Names:"; then
288298
echo "❌ test-router.sh --help not working correctly"
289299
exit 1
290300
fi
291-
301+
292302
# Discover available tests dynamically
293303
echo "🔍 Discovering available tests in test-router.sh..."
294-
available_tests=($(./test-router.sh --help 2>&1 | grep -A 20 "Test Names:" | grep -E "^ [a-zA-Z-]+" | sed 's/^ //' | sed 's/ .*//' | tr '\n' ' '))
295-
304+
available_tests=($(./test-router.sh --help 2>&1 | \
305+
grep -A 20 "Test Names:" | grep -E "^ [a-zA-Z-]+" | \
306+
sed 's/^ //' | sed 's/ .*//' | tr '\n' ' '))
307+
296308
if [ ${#available_tests[@]} -eq 0 ]; then
297309
echo "❌ No tests found in test-router.sh help output"
298310
exit 1
299311
fi
300-
312+
301313
echo "✅ Found ${#available_tests[@]} available tests:"
302314
for test in "${available_tests[@]}"; do
303315
echo " - $test"
304316
done
305-
317+
306318
# Check for essential tests
307319
essential_tests=("health" "products" "status" "all")
308320
for test in "${essential_tests[@]}"; do
@@ -311,96 +323,98 @@ jobs:
311323
exit 1
312324
fi
313325
done
314-
326+
315327
echo "✅ test-router.sh functionality working correctly"
316-
328+
317329
# Test that build validation script exists and has help
318330
echo "Testing build validation script..."
319-
331+
320332
# Check if build-validate.sh exists
321333
if [ ! -f "scripts/build-validate.sh" ]; then
322334
echo "❌ build-validate.sh not found in scripts directory"
323335
exit 1
324336
fi
325-
337+
326338
# Test that it has help functionality
327339
if ! ./scripts/build-validate.sh --help 2>&1 | grep -q "Usage:"; then
328340
echo "❌ build-validate.sh --help not working correctly"
329341
exit 1
330342
fi
331-
343+
332344
echo "✅ build-validate.sh exists and has help functionality"
333-
345+
334346
# Test all scripts that have --help functionality
335347
echo "Testing script help functionality..."
336348
echo "🔍 Checking which scripts support --help..."
337-
349+
338350
help_scripts=()
339351
for script in "${user_scripts[@]}"; do
340352
if ./"$script" --help 2>&1 | grep -q "Usage:\|Options:"; then
341353
help_scripts+=("$script")
342354
fi
343355
done
344-
356+
345357
for script in "${internal_scripts[@]}"; do
346-
if ./"scripts/$script" --help 2>&1 | grep -q "Usage:\|Options:"; then
358+
if ./"scripts/$script" --help 2>&1 | \
359+
grep -q "Usage:\|Options:"; then
347360
help_scripts+=("scripts/$script")
348361
fi
349362
done
350-
363+
351364
if [ ${#help_scripts[@]} -gt 0 ]; then
352-
echo "✅ Found ${#help_scripts[@]} scripts with help functionality:"
365+
echo "✅ Found ${#help_scripts[@]} scripts with help \
366+
functionality:"
353367
for script in "${help_scripts[@]}"; do
354368
echo " - $script"
355369
done
356370
else
357371
echo "⚠️ No scripts found with help functionality"
358372
fi
359-
373+
360374
# Test that documentation structure is correct
361375
echo "Testing documentation structure..."
362-
376+
363377
# Check that README.md exists and points to SETUP.md
364378
if ! grep -q "SETUP.md" README.md; then
365379
echo "❌ README.md missing reference to SETUP.md"
366380
exit 1
367381
fi
368-
382+
369383
# Check that SETUP.md exists and contains commands
370384
if [ ! -f "SETUP.md" ]; then
371385
echo "❌ SETUP.md not found"
372386
exit 1
373387
fi
374-
388+
375389
# Check that ARCHITECTURE.md exists
376390
if [ ! -f "ARCHITECTURE.md" ]; then
377391
echo "❌ ARCHITECTURE.md not found"
378392
exit 1
379393
fi
380-
394+
381395
# Check that README-K8S.md is deleted
382396
if [ -f "README-K8S.md" ]; then
383397
echo "❌ README-K8S.md still exists (should be deleted)"
384398
exit 1
385399
fi
386-
400+
387401
echo "✅ Documentation structure is correct"
388-
402+
389403
# Test that cleanup-k8s.sh provides helpful output
390404
echo "Testing cleanup-k8s.sh output..."
391-
405+
392406
# Test that it mentions minikube is still running
393407
if ! ./cleanup-k8s.sh 2>&1 | grep -q "Minikube is still running"; then
394408
echo "❌ cleanup-k8s.sh missing minikube warning"
395409
exit 1
396410
fi
397-
411+
398412
# Test that it mentions kill-minikube.sh
399413
if ! ./cleanup-k8s.sh 2>&1 | grep -q "kill-minikube.sh"; then
400414
echo "❌ cleanup-k8s.sh missing kill-minikube.sh reference"
401415
exit 1
402416
fi
403-
417+
404418
echo "✅ cleanup-k8s.sh provides helpful output"
405419
406420
test-k8s-yaml:

scripts/test-utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
if [ -z "$SCRIPT_DIR" ]; then
1414
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1515
fi
16-
source "$SCRIPT_DIR/scripts/utils.sh"
17-
source "$SCRIPT_DIR/scripts/config.sh"
16+
source "$SCRIPT_DIR/utils.sh"
17+
source "$SCRIPT_DIR/config.sh"
1818

1919
# Default values (now from config)
2020
ROUTER_URL=$(get_router_graphql_url | sed 's|/graphql$||')

0 commit comments

Comments
 (0)