This document outlines the comprehensive testing infrastructure for NEXO CRM. Every step, activity, and development workflow includes automated testing to ensure reliability and ease of onboarding.
- Every step must be testable: All infrastructure, code, and workflows have automated tests
- Simplest possible approach: Use MISE tasks or Makefile - whichever you prefer
- Easy onboarding: New developers should run one command to validate their setup
# Setup entire development environment
bash scripts/setup-dev.sh
# Or using MISE
mise run setup
# Or using Make
make setup# Start development
mise run dev
# or
make dev
# Run all tests
mise run test:all
# or
make test-all
# Stop development
mise run dev:stop
# or
make dev-stopYou can use any of these three methods - they all do the same thing:
# View all available tasks
mise tasks
# Run specific test
mise run docker:validate
mise run test:docker:health
mise run k8s:validate
# Run test suites
mise run test:quick # Quick validation
mise run test:all # Comprehensive tests
mise run ci:test # CI/CD pipeline# View all available targets
make help
# Run specific test
make docker-validate
make test-docker-health
make test-k8s-validate
# Run test suites
make test-quick # Quick validation
make test-all # Comprehensive tests
make test-ci # CI/CD pipeline# Run test scripts directly
bash scripts/test-docker-health.sh
bash scripts/test-docker-connectivity.sh
bash scripts/validate-k8s.sh
bash scripts/ci-test.shValidate Configuration
mise run docker:validate # Check docker-compose.yml syntax
make docker-validateHealth Checks
mise run test:docker:health # Test all service health endpoints
make test-docker-healthTests:
- PostgreSQL database connection
- Redis ping/pong
- Keycloak
/health/readyendpoint - Frontend HTTP response
- Prometheus
/-/healthyendpoint - Grafana
/api/healthendpoint
Connectivity Tests
mise run test:docker:connectivity # Test service-to-service connections
make test-docker-connectivityTests:
- Keycloak → PostgreSQL
- Frontend → Redis
- Frontend → Keycloak
- Prometheus → Frontend (metrics scraping)
Validate Manifests
mise run k8s:validate # Validate YAML syntax and structure
make test-k8s-validateDry Run Deployment
mise run k8s:dry-run # Test deployment without applying
make k8s-dry-runNx Installation
mise run test:nx:install # Verify Nx CLI is available
make test-nxDependencies
mise run test:pnpm:install # Install and verify dependencies
make test-pnpmBuild Tests
mise run test:nx:build:all # Build all projects
make test-nx-buildLint Tests
mise run test:nx:lint:all # Lint all projects
make test-nx-lintUnit Tests
mise run test:nx:test:all # Run all unit tests
make test-nx-testQuick Tests (for rapid feedback)
mise run test:quick
make test-quickRuns:
- Docker Compose validation
- Kubernetes manifests validation
- Nx installation check
Full Test Suite (before commits)
mise run test:all
make test-allRuns:
- Docker Compose validation
- Docker services health checks
- Kubernetes manifests validation
- Nx installation verification
- pnpm dependencies installation
CI/CD Pipeline (automated testing)
mise run ci:test
make test-ciRuns:
- Docker Compose validation
- Kubernetes manifests validation
- Nx installation check
- Dependencies installation (frozen lockfile)
- Lint all projects
- Test all projects
- Build all projects
mise run dev
make devWhat it does:
- Starts all Docker services
- Waits for services to be healthy
- Confirms environment is ready
mise run dev:frontend
make dev-frontendmise run dev:backend
make dev-backendmise run urls
make urlsShows:
- Frontend: http://localhost:3000
- Keycloak: http://localhost:8080
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001
- PostgreSQL: localhost:5432
- Redis: localhost:6379
# All services
mise run docker:logs
make docker-logs
# Specific service
mise run logs:frontend
make logs-frontend
mise run logs:postgres
make logs-postgres# Connect to PostgreSQL
mise run db:shell
make db-shell
# Backup database
mise run db:backup
make db-backup
# Connect to Redis
mise run redis:shell
make redis-shell# Clean Docker resources
mise run docker:clean
make docker-clean
# Clean everything (Docker + node_modules + dist)
mise run clean:all
make clean-allname: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup MISE
uses: jdx/mise-action@v2
- name: Run CI Tests
run: mise run ci:testtest:
image: ubuntu:latest
script:
- curl https://mise.jdx.dev/install.sh | sh
- mise run ci:testpipeline {
agent any
stages {
stage('Test') {
steps {
sh 'mise run ci:test'
}
}
}
}All test scripts are located in scripts/ directory:
test-docker-health.sh- Docker services health checkstest-docker-connectivity.sh- Service connectivity testsvalidate-k8s.sh- Kubernetes manifests validationci-test.sh- Complete CI/CD test pipelinesetup-dev.sh- Development environment setupdeploy.sh- Kubernetes deployment
✅ All tests passed!
All services are healthy and functioning correctly.
❌ 2 service(s) failed health checks
Check logs for specific service:
mise run docker:logs
mise run logs:frontend # or specific service⚠️ kubectl not found, skipping K8s validation
Install missing dependencies:
# Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/# Check Docker is running
docker info
# Check service logs
mise run docker:logs
# Restart services
mise run docker:restart
make docker-restartIf ports are already in use, edit docker/docker-compose.yml to change port mappings.
# Add user to docker group
sudo usermod -aG docker $USER
# Re-login for changes to take effectIncrease timeout in test scripts or check system resources:
# Check system resources
docker stats
# Check available memory
free -h-
Run tests before commits
mise run test:all
-
Run quick tests during development
mise run test:quick
-
Check service health after starting
mise run dev mise run test:docker:health
-
Clean up regularly
mise run docker:clean
-
Keep dependencies updated
cd nexo-prj && pnpm update
For issues or questions:
- Check ARCHITECTURE.md for system design
- Review docker/docs/docker.md for Docker setup
- Run diagnostic tests:
mise run test:all - Check service logs:
mise run docker:logs