diff --git a/.drone.yml b/.drone.yml index dcd3d19..9a5daf9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -271,11 +271,14 @@ steps: local description="$2" echo "Testing $description ($url)..." - local status_code=$(curl -o /dev/null -s -w "%{http_code}" -m 10 "$url" 2>/dev/null || echo "000") + local status_code=$(curl -L -o /dev/null -s -w "%{http_code}" -m 10 "$url" 2>/dev/null || echo "000") if [ "$status_code" = "200" ]; then echo "✅ $description - OK (HTTP $status_code)" return 0 + elif [ "$status_code" = "301" ] || [ "$status_code" = "302" ]; then + echo "✅ $description - Redirect (HTTP $status_code)" + return 0 elif [ "$status_code" = "404" ]; then echo "⚠️ $description - Not Found (HTTP $status_code)" return 1 @@ -294,25 +297,38 @@ steps: # Основные страницы total_tests=$((total_tests + 1)) - test_endpoint "$TEST_TARGET/" "Homepage" || ((errors++)) + if ! test_endpoint "$TEST_TARGET/" "Homepage"; then + errors=$((errors + 1)) + fi total_tests=$((total_tests + 1)) - test_endpoint "$TEST_TARGET/services/" "Services page" || ((errors++)) + if ! test_endpoint "$TEST_TARGET/services/" "Services page"; then + errors=$((errors + 1)) + fi total_tests=$((total_tests + 1)) - test_endpoint "$TEST_TARGET/career/" "Career page" || ((errors++)) + if ! test_endpoint "$TEST_TARGET/career/" "Career page"; then + errors=$((errors + 1)) + fi total_tests=$((total_tests + 1)) - test_endpoint "$TEST_TARGET/contact/" "Contact page" || ((errors++)) + if ! test_endpoint "$TEST_TARGET/contact/" "Contact page"; then + errors=$((errors + 1)) + fi total_tests=$((total_tests + 1)) - test_endpoint "$TEST_TARGET/admin/" "Admin panel" || echo "ℹ️ Admin panel test failed (expected for production)" + if ! test_endpoint "$TEST_TARGET/admin/" "Admin panel"; then + echo "ℹ️ Admin panel test failed (expected for production)" + fi echo "" echo "📊 Integration Test Results:" echo " Total tests: $total_tests" echo " Failures: $errors" - echo " Success rate: $(( (total_tests - errors) * 100 / total_tests ))%" + if [ $total_tests -gt 0 ]; then + success_rate=$(( (total_tests - errors) * 100 / total_tests )) + echo " Success rate: ${success_rate}%" + fi if [ $errors -gt 2 ]; then echo "❌ Too many critical endpoint failures ($errors)"