This directory contains tests for the Ambient Code Platform, with a focus on validating the local developer experience.
File: local-dev-test.sh
Comprehensive integration test suite that validates the complete local development environment.
What it tests:
- ✅ Prerequisites (make, kubectl, kind, podman/docker)
- ✅ Makefile commands and syntax
- ✅ Kind cluster status
- ✅ Kubernetes configuration
- ✅ Namespace and CRDs
- ✅ Pod health and readiness
- ✅ Service configuration
- ✅ Ingress setup
- ✅ Backend health endpoints
- ✅ Frontend accessibility
- ✅ RBAC configuration
- ✅ Build and reload commands
- ✅ Logging functionality
- ✅ Storage configuration
- ✅ Environment variables
- ✅ Resource limits
- ✅ Ingress controller
49 tests total
Run everything with a single command:
make test-allThis runs:
- Quick smoke test (5 tests)
- Comprehensive test suite (49 tests)
Total: 54 tests
Run a fast validation of the essential components:
make local-test-quickTests:
- Kind cluster running
- Namespace exists
- Pods running
- Backend healthy
- Frontend accessible
Run all 49 tests:
make local-test-devOr run directly:
./tests/local-dev-test.shThe comprehensive test suite supports several options:
# Skip initial setup
./tests/local-dev-test.sh --skip-setup
# Clean up after tests
./tests/local-dev-test.sh --cleanup
# Verbose output
./tests/local-dev-test.sh --verbose
# Show help
./tests/local-dev-test.sh --helpOne command to run everything:
make test-allValidate your environment is ready:
make local-test-quickVerify everything still works:
make test-allOr just the comprehensive suite:
make local-test-dev# Start environment
make kind-up
# Wait for pods to be ready
sleep 30
# Run tests
make local-test-dev
# Cleanup
make local-down═══════════════════════════════════════════
Test Summary
═══════════════════════════════════════════
Results:
Passed: 49
Failed: 0
Total: 49
✓ All tests passed!
ℹ Your local development environment is ready!
ℹ Access the application:
ℹ • Frontend: http://192.168.64.4:30030
ℹ • Backend: http://192.168.64.4:30080
Exit code: 0
═══════════════════════════════════════════
Test Summary
═══════════════════════════════════════════
Results:
Passed: 45
Failed: 4
Total: 49
✗ Some tests failed
✗ Your local development environment has issues
ℹ Run 'make local-troubleshoot' for more details
Exit code: 1
- 🔵 Blue (ℹ) - Information
- 🟢 Green (✓) - Test passed
- 🔴 Red (✗) - Test failed
- 🟡 Yellow (⚠) - Warning (non-critical)
make kind-upkubectl create namespace ambient-codemake local-status
make local-troubleshootmake local-logs-backend
make kind-reload-backendtest_my_feature() {
log_section "Test X: My Feature"
# Test logic here
if condition; then
log_success "Feature works"
((PASSED_TESTS++))
else
log_error "Feature broken"
((FAILED_TESTS++))
fi
}assert_command_exists "command" # Check if command exists
assert_equals "expected" "actual" "desc" # Check equality
assert_contains "haystack" "needle" "desc" # Check substring
assert_http_ok "url" "desc" [retries] # Check HTTP endpoint
assert_pod_running "label" "desc" # Check pod status- Create a new test function in
local-dev-test.sh - Add it to the
main()function - Update the test count in this README
- Document what it tests
The Makefile provides convenient shortcuts:
# Quick smoke test (5 seconds)
make local-test-quick
# Full test suite (30 seconds)
make local-test-dev
# Backward compatibility
make local-test # → local-test-quickPlanned additions:
- Backend Go code tests
- Frontend React component tests
- Utility function tests
- API contract validation
- CRD schema validation
- Service interface tests
- Multi-component workflows
- End-to-end scenarios
- Session creation and execution
- Load testing
- Resource usage
- Startup time
When adding features to the local development environment:
- Update tests - Add tests for new commands or features
- Run tests - Ensure
make local-test-devpasses - Document - Update this README if adding new test categories
Wait for pods to be ready before running tests:
make kind-up
sleep 30
make local-test-devRun troubleshooting:
make local-troubleshootUse quick smoke test for rapid validation:
make local-test-quickRun with verbose output:
./tests/local-dev-test.sh --verbose- Before every commit -
make local-test-quick - Before every PR -
make local-test-dev - Weekly - Full cleanup and restart
make kind-down make kind-up make local-test-dev
When you:
- Add new Makefile commands → Add tests
- Change component names → Update test expectations
- Modify deployments → Update pod/service tests
- Update RBAC → Update permission tests
If tests are failing and you need help:
- Check the output for specific failures
- Run
make local-troubleshoot - Check pod logs:
make local-logs - Review the test source:
tests/local-dev-test.sh - Ask the team in Slack
- Makefile - Developer commands
- Local Development Guide - Setup instructions
- CONTRIBUTING.md - Contribution guidelines
