provisioning-catalog/providers/digitalocean/tests/run_digitalocean_tests.nu

110 lines
5.5 KiB
Text

#!/usr/bin/env nu
# DigitalOcean Provider Test Suite Orchestrator
# Runs all unit and integration tests (51 total: 14 unit + 37 integration)
use unit/test_utils.nu
use integration/test_api_client.nu
use integration/test_server_lifecycle.nu
use integration/test_pricing_cache.nu
export def main [] {
print "╔════════════════════════════════════════════════════════╗"
print "║ DigitalOcean Provider Test Suite ║"
print "║ Framework: Mock-based (no real API calls) ║"
print "║ Total Tests: 51 (14 unit + 37 integration) ║"
print "╚════════════════════════════════════════════════════════╝"
print ""
# Run unit tests
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print "PHASE 1: UNIT TESTS (14 tests)"
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print ""
let unit_result = (test_utils run_unit_tests)
print ""
print $"Unit Tests Result: ($unit_result.passed)/($unit_result.total) passed"
print ""
# Run API client tests
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print "PHASE 2: INTEGRATION TESTS - API CLIENT (13 tests)"
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print ""
let api_result = (test_api_client run_api_tests)
print ""
print $"API Client Tests Result: ($api_result.passed)/($api_result.total) passed"
print ""
# Run server lifecycle tests
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print "PHASE 3: INTEGRATION TESTS - SERVER LIFECYCLE (12 tests)"
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print ""
let lifecycle_result = (test_server_lifecycle run_lifecycle_tests)
print ""
print $"Lifecycle Tests Result: ($lifecycle_result.passed)/($lifecycle_result.total) passed"
print ""
# Run pricing/cache tests
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print "PHASE 4: INTEGRATION TESTS - PRICING & CACHE (12 tests)"
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print ""
let pricing_result = (test_pricing_cache run_pricing_tests)
print ""
print $"Pricing Tests Result: ($pricing_result.passed)/($pricing_result.total) passed"
print ""
# Summary
print "╔════════════════════════════════════════════════════════╗"
print "║ TEST SUMMARY ║"
print "╚════════════════════════════════════════════════════════╝"
print ""
let total_passed = (
$unit_result.passed
+ $api_result.passed
+ $lifecycle_result.passed
+ $pricing_result.passed
)
let total_failed = (
$unit_result.failed
+ $api_result.failed
+ $lifecycle_result.failed
+ $pricing_result.failed
)
let total_tests = (
$unit_result.total
+ $api_result.total
+ $lifecycle_result.total
+ $pricing_result.total
)
print $" Unit Tests: ($unit_result.passed)/($unit_result.total) passed"
print $" API Client Tests: ($api_result.passed)/($api_result.total) passed"
print $" Lifecycle Tests: ($lifecycle_result.passed)/($lifecycle_result.total) passed"
print $" Pricing Tests: ($pricing_result.passed)/($pricing_result.total) passed"
print ""
print " ───────────────────────────────────────────────────────"
print $" TOTAL: ($total_passed)/($total_tests) passed"
print ""
if $total_failed == 0 {
print " Status: ✓ ALL TESTS PASSED"
print "╚════════════════════════════════════════════════════════╝"
print ""
exit 0
} else {
print $" Status: ✗ ($total_failed) TEST(S) FAILED"
print "╚════════════════════════════════════════════════════════╝"
print ""
exit 1
}
}