INTEGRATION TEST SUITE V0.9.8 - nself-org/cli GitHub Wiki
Comprehensive end-to-end integration test suite created for nself v0.9.8 release. Validates critical user workflows work correctly from initialization through production deployment.
Status: โ Complete and Ready for Release
| Test Suite | Test Cases | Runtime | Purpose |
|---|---|---|---|
| Full Deployment | 14 | 5-7 min | Complete init โ build โ start workflow |
| Multi-Tenant | 10 | 3-4 min | Tenant lifecycle and isolation |
| Backup/Restore | 11 | 4-5 min | Backup creation and restoration |
| Migrations | 11 | 3-4 min | Database schema changes |
| Monitoring Stack | 11 | 6-8 min | All 10 monitoring services |
| Custom Services | 13 | 4-5 min | CS_N configuration and routing |
| TOTAL | 70 | 25-35 min | Complete workflow coverage |
-
Test Utilities (
utils/integration-helpers.sh)- 20+ reusable helper functions
- Project setup/cleanup automation
- Service health checking
- Endpoint verification
- Data management
- Service mocking
-
Master Test Runner (
run-all-integration-tests.sh)- Executes all test suites
- Comprehensive reporting
- Failed test tracking
- Parallel execution support
- Time tracking
-
CI/CD Integration (
.github/workflows/integration-tests.yml)- Automated testing on push
- Matrix testing (Ubuntu + macOS)
- Artifact upload
- Test result reporting
-
Documentation
- README.md - Complete guide
- INTEGRATION-TEST-SUMMARY.md - Overview
- QUICK-START.md - Quick reference
- This document - Complete documentation
src/tests/integration/
โโโ test-full-deployment.sh (14 tests, 11 KB)
โโโ test-multi-tenant-workflow.sh (10 tests, 11 KB)
โโโ test-backup-restore-workflow.sh (11 tests, 12 KB)
โโโ test-migration-workflow.sh (11 tests, 12 KB)
โโโ test-monitoring-stack.sh (11 tests, 11 KB)
โโโ test-custom-services-workflow.sh (13 tests, 11 KB)
src/tests/integration/utils/
โโโ integration-helpers.sh (13 KB, 20+ functions)
src/tests/integration/
โโโ run-all-integration-tests.sh (9 KB, master runner)
โโโ verify-test-suite.sh (8 KB, verification)
src/tests/integration/
โโโ README.md (15 KB, complete guide)
โโโ INTEGRATION-TEST-SUMMARY.md (10 KB, overview)
โโโ QUICK-START.md (3 KB, quick reference)
docs/testing/
โโโ INTEGRATION-TEST-SUITE-V0.9.8.md (this file)
.github/workflows/
โโโ integration-tests.yml (4.6 KB, GitHub Actions)
Purpose: Validate complete deployment lifecycle
Test Cases:
- Initialize project with
--simple - Modify
.envconfiguration - Build configuration files
- Start all services
- Wait for services healthy
- Verify
nself status - Verify
nself urls - Test database connection
- Test Hasura GraphQL endpoint
- Test Auth service endpoint
- Stop all services cleanly
- Restart services
- Test restart command
- Final cleanup verification
Coverage:
- โ Project initialization
- โ Configuration generation
- โ Service orchestration
- โ Health checking
- โ API endpoints
- โ Lifecycle management
Purpose: Validate multi-tenancy functionality
Test Cases:
- Setup with multi-tenancy enabled
- Create test tenants
- Add members to tenants
- Assign and verify roles
- Test tenant data isolation
- Update tenant settings
- List all tenants
- Remove member from tenant
- Delete tenant with cleanup
- Verify remaining tenant unaffected
Coverage:
- โ Tenant creation/deletion
- โ Member management
- โ Role-based access control
- โ Data isolation (critical!)
- โ Settings management
- โ Cleanup verification
Purpose: Validate backup and restore functionality
Test Cases:
- Setup test environment
- Create initial test data
- Create full backup
- Verify backup contents
- Modify data after backup
- Restore from backup
- Verify restored data matches original
- Create incremental backup
- List all backups
- Test automated backup scheduling
- Test backup cleanup (retention policy)
Coverage:
- โ Full backup creation
- โ Backup validation
- โ Data restoration
- โ Incremental backups
- โ Retention policies
- โ Automated scheduling
Purpose: Validate database migration system
Test Cases:
- Setup and run initial migrations
- Verify initial schema
- Create new migration
- Run new migration
- Check migration status
- Insert test data
- Create alter table migration
- Test migration rollback
- Verify rollback correctness
- Test fresh migrations (reset)
- Test migration locking
Coverage:
- โ Migration creation
- โ Migration execution
- โ Schema verification
- โ Rollback functionality
- โ Fresh migrations
- โ Concurrent migration protection
Purpose: Validate complete monitoring bundle (10 services)
Test Cases:
- Setup with monitoring enabled
- Verify all 10 services running:
- Prometheus
- Grafana
- Loki
- Promtail (required for Loki)
- Tempo
- Alertmanager
- cAdvisor
- Node Exporter
- Postgres Exporter
- Redis Exporter
- Test Prometheus scraping metrics
- Test Grafana dashboards
- Test Loki log aggregation
- Test Alertmanager configuration
- Test Tempo tracing
- Verify exporter metrics
- Verify bundle is all-or-nothing
- Test disabling individual service
- Verify monitoring URLs
Coverage:
- โ All 10 monitoring services
- โ Metrics collection
- โ Dashboard access
- โ Log aggregation
- โ Distributed tracing
- โ Alert management
Purpose: Validate custom service (CS_N) functionality
Test Cases:
- Setup with custom services (CS_1 to CS_4)
- Verify service directories created
- Verify docker-compose configuration
- Start all services
- Verify nginx routes
- Test service endpoints
- Verify logs accessible
- Modify service code and rebuild
- Test service restart
- Remove custom service
- Add new custom service
- Verify service isolation
- Test environment variables
Coverage:
- โ Template-based service generation
- โ Docker Compose integration
- โ Nginx routing
- โ Service isolation
- โ Dynamic service management
- โ Environment configuration
setup_test_project([name]) # Create isolated test environment
cleanup_test_project([dir]) # Remove test project and containers
generate_test_project_name() # Generate unique project namewait_for_service_healthy(service, [timeout], [interval])
wait_for_all_services_healthy([timeout], [interval])
assert_service_running(service)verify_endpoint_accessible(url, [timeout], [expected_status])
verify_graphql_endpoint(url, [admin_secret])create_test_data(table, json_data)
verify_test_data(table, condition)
clear_test_data(table, [condition])mock_external_service(port, response_file)
stop_mock_service(pid)get_service_logs(service, [lines])
get_service_container_id(service)
exec_in_service(service, command)
wait_for_port(host, port, [timeout])# Run all integration tests
cd src/tests/integration
./run-all-integration-tests.sh
# Run specific test
./run-all-integration-tests.sh --test full-deployment
# Run with verbose output
./run-all-integration-tests.sh --verbose
# Run individual test directly
./test-full-deployment.sh# Verify test suite is properly set up
cd src/tests/integration
./verify-test-suite.sh=================================================================
nself Integration Test Suite v0.9.8
=================================================================
Overall Statistics:
Test Suites: 6
Total Tests: 70
Passed: 70
Failed: 0
Skipped: 0
Total Time: 28:45
Pass Rate: 100%
Individual Test Results:
โ test-full-deployment 05:32
โ test-multi-tenant-workflow 03:28
โ test-backup-restore-workflow 04:15
โ test-migration-workflow 03:45
โ test-monitoring-stack 07:22
โ test-custom-services-workflow 04:23
Recommendations:
โ All integration tests passed! Ready for release.
File: .github/workflows/integration-tests.yml
Triggers:
- Push to
mainordevelopbranches - Pull requests to
mainordevelop - Manual workflow dispatch
- Changes to:
src/**bin/**src/tests/integration/**.github/workflows/integration-tests.yml
Jobs:
-
integration-tests: Run all tests
- Matrix: Ubuntu Latest, macOS Latest
- Upload test results as artifacts
-
test-summary: Generate summary
- Download artifacts
- Create summary report
-
critical-tests: Run critical tests only
- Quick validation
- Runs on every commit
- Go to GitHub repository
- Click "Actions" tab
- Select "Integration Tests" workflow
- View results for each run
- Download artifacts for detailed logs
Each test runs in:
- Unique temporary directory:
/tmp/nself-integration-test-{PID}-{TIMESTAMP} - Isolated Docker containers
- Separate Docker networks
- Independent databases
- Automatic cleanup on exit
Minimum:
- 4 GB RAM
- 10 GB disk space
- Docker & Docker Compose
Recommended:
- 8 GB RAM
- 20 GB disk space
- Fast SSD storage
Tests automatically cleanup:
- Docker containers
- Docker volumes
- Docker networks
- Temporary directories
- Test data
./run-all-integration-tests.sh --verbose# Edit test file, change:
CLEANUP_ON_EXIT=false
# Run test
./test-full-deployment.sh
# Inspect environment
cd /tmp/nself-integration-test-*
docker-compose ps
docker-compose logs <service># During test
docker-compose logs -f <service_name>
# After test (if cleanup disabled)
cd /tmp/nself-integration-test-*
docker-compose logs <service_name> --tail=100# Remove test containers
docker ps -a | grep nself-integration-test | awk '{print $1}' | xargs docker rm -f
# Remove test directories
rm -rf /tmp/nself-integration-test-*
# Clean Docker system
docker system prune -af --volumes- Use Template: Copy existing test structure
- Independence: Tests should not depend on each other
- Cleanup: Always use trap for cleanup
- Unique Names: Use unique project names
- Timeouts: Add reasonable timeouts
- Descriptive: Clear test descriptions
- Assertions: Use helper assertions
- Logging: Capture logs on failures
#!/usr/bin/env bash
set -euo pipefail
# Load utilities
TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$TEST_DIR/utils/integration-helpers.sh"
source "$TEST_DIR/../test_framework.sh"
# Configuration
TEST_PROJECT_DIR=""
CLEANUP_ON_EXIT=true
# Cleanup handler
cleanup() {
if [[ "$CLEANUP_ON_EXIT" == "true" ]] && [[ -n "$TEST_PROJECT_DIR" ]]; then
cleanup_test_project "$TEST_PROJECT_DIR"
fi
}
trap cleanup EXIT INT TERM
# Test functions
test_01_setup() { ... }
test_02_verify() { ... }
# Main runner
main() { ... }- External Services: Mock external APIs (Stripe, OAuth)
- Performance: Not performance/load tested
- Security: Not security tested
- Browser: No browser-based E2E tests
- Network: Assumes reliable network
- OAuth provider workflow test
- Deployment pipeline test
- SSL/TLS configuration test
- Service dependencies test
- Performance benchmarking
- Load testing integration
- Security testing integration
- Browser-based E2E tests
- Multi-region deployment tests
- Disaster recovery tests
- โ 70 test cases created and passing
- โ 6 critical workflows covered
- โ 25-35 minutes total runtime
- โ CI/CD integration complete
- โ Documentation comprehensive
- โ Helper utilities reusable
- โ Debugging tools available
- Pass Rate: Must be 100% for release
- Runtime: Under 40 minutes total
- Isolation: Each test fully isolated
- Cleanup: Zero artifacts remaining
- Documentation: Up-to-date
- Check
README.mdfor detailed documentation - Review
QUICK-START.mdfor quick reference - Run
./verify-test-suite.shto check setup - Create GitHub issue if stuck
- Create new test file from template
- Make executable:
chmod +x test-*.sh - Test locally
- Update documentation
- Add to CI workflow if needed
- Submit pull request
nself/
โโโ .github/workflows/
โ โโโ integration-tests.yml
โโโ docs/testing/
โ โโโ INTEGRATION-TEST-SUITE-V0.9.8.md
โโโ src/tests/
โโโ test_framework.sh
โโโ integration/
โโโ README.md
โโโ INTEGRATION-TEST-SUMMARY.md
โโโ QUICK-START.md
โโโ run-all-integration-tests.sh
โโโ verify-test-suite.sh
โโโ utils/
โ โโโ integration-helpers.sh
โโโ test-full-deployment.sh
โโโ test-multi-tenant-workflow.sh
โโโ test-backup-restore-workflow.sh
โโโ test-migration-workflow.sh
โโโ test-monitoring-stack.sh
โโโ test-custom-services-workflow.sh
v0.9.8 (2026-01-31)
- Initial comprehensive integration test suite
- 6 test suites with 70 test cases
- Complete helper utilities
- CI/CD integration
- Full documentation
Document Version: 1.0 Created: 2026-01-31 Last Updated: 2026-01-31 Status: โ Complete Release: v0.9.8