syntaxis/scripts/provisioning/test-catalog.nu
Jesús Pérez 9cef9b8d57 refactor: consolidate configuration directories
Merge _configs/ into config/ for single configuration directory.
Update all path references.

Changes:
- Move _configs/* to config/
- Update .gitignore for new patterns
- No code references to _configs/ found

Impact: -1 root directory (layout_conventions.md compliance)
2025-12-26 18:36:23 +00:00

73 lines
2.4 KiB
Plaintext

#!/usr/bin/env nu
# test-catalog.nu - Validate service catalog TOML structure
print "═══════════════════════════════════════════════════════════════"
print "SERVICE CATALOG VALIDATION TEST"
print "═══════════════════════════════════════════════════════════════"
print ""
# Load catalog
print "1. Loading configs/services-catalog.toml..."
let catalog = (open configs/services-catalog.toml)
print " ✓ Loaded successfully"
print ""
# Check version
print "2. Checking catalog version..."
let version = ($catalog.version.catalog_version)
print $" Version: ($version)"
print " ✓ Catalog version found"
print ""
# Count services
print "3. Counting services..."
let service_count = ($catalog.service | length)
print $" Total services: ($service_count)"
print ""
# List services
print "4. Service inventory:"
let services = ($catalog.service | transpose)
$services | each { |svc|
let name = ($svc.key)
let display = ($svc.value.display_name? // $name)
print $" - ($display)"
}
print ""
# Check ports
print "5. Port assignments:"
$services | each { |svc|
let name = ($svc.key)
let server = ($svc.value.server? // null)
if ($server != null) {
let port = ($server.default_port?)
print $" ($name): port ($port)"
}
}
print ""
# Check service groups
print "6. Service groups:"
let groups = ($catalog.groups | transpose)
$groups | each { |grp|
let gname = ($grp.key)
let gcount = (($grp.value.services | length))
print $" ($gname): ($gcount) services"
}
print ""
# Check patterns
print "7. Deployment patterns:"
let patterns = ($catalog.pattern | transpose)
$patterns | each { |ptn|
let pname = ($ptn.key)
let pcount = (($ptn.value.services | length))
print $" ($pname): ($pcount) services"
}
print ""
print "═══════════════════════════════════════════════════════════════"
print "✅ All validations passed!"
print "═══════════════════════════════════════════════════════════════"