# Docker Validation Suite for Claude-Flow This directory contains Docker-based testing infrastructure to validate claude-flow functionality in a clean, isolated environment that simulates a remote deployment. ## ๐ŸŽฏ Purpose - **Clean Environment Testing**: Validates installation in a fresh environment without local dependencies - **Production Simulation**: Tests the actual user experience of installing and using claude-flow - **CI/CD Integration**: Can be used in automated testing pipelines - **Cross-Platform Validation**: Tests on Linux (Alpine) to ensure portability ## ๐Ÿ“ Files - `Dockerfile.test` - Main test container with Node 18 and required dependencies - `docker-compose.test.yml` - Multi-container setup for integration testing - `run-validation.sh` - Comprehensive validation script (50+ tests) - `README.md` - This file ## ๐Ÿš€ Quick Start ### Option 1: Build and Run Validation (Recommended) ```bash # From project root cd tests/docker # Build the test container docker build -f Dockerfile.test -t claude-flow-test ../.. # Run validation suite docker run --rm claude-flow-test sh -c "cd /home/testuser && tests/docker/run-validation.sh" ``` ### Option 2: Interactive Testing ```bash # Start container with docker-compose docker-compose -f docker-compose.test.yml up -d # Enter the container docker exec -it claude-flow-test sh # Inside container, run tests cd /home/testuser ./tests/docker/run-validation.sh # Or test individual commands ./bin/claude-flow --help ./bin/claude-flow memory store test "value" ./bin/claude-flow agent agents ``` ### Option 3: Full Integration Test Suite ```bash # Start all services (including SQLite) docker-compose -f docker-compose.test.yml up -d # Run integration tests docker-compose -f docker-compose.test.yml exec claude-flow-integration \ sh -c "cd /home/testuser && ./tests/docker/run-validation.sh" # Clean up docker-compose -f docker-compose.test.yml down -v ``` ## ๐Ÿงช Test Coverage The validation suite tests: ### Phase 1: Installation & Build - โœ… NPM and Node.js versions - โœ… Build completion - โœ… Binary generation ### Phase 2: CLI Basic Commands - โœ… Help command - โœ… Version command - โœ… Agent help ### Phase 3: Memory Commands (Basic Mode) - โœ… Memory store - โœ… Memory query - โœ… Memory stats - โœ… Memory list - โœ… Memory export/import ### Phase 4: ReasoningBank Commands - โœ… Mode detection - โœ… Mode configuration - โœ… Status display ### Phase 5: Agent Commands - โœ… Agent listing - โœ… Agent info - โœ… Agent configuration ### Phase 6: Proxy Commands - โœ… Proxy help - โœ… Proxy configuration - โœ… OpenRouter integration ### Phase 7: Help System - โœ… Main help with all features - โœ… Agent help with memory - โœ… Feature discoverability ### Phase 8: Security Features - โœ… API key redaction - โœ… Secure storage - โœ… Redacted queries ### Phase 9: File Structure - โœ… Memory directory creation - โœ… Memory store file - โœ… Proper permissions ### Phase 10: Integration Tests - โœ… Import/export workflows - โœ… Namespace operations - โœ… Error handling ## ๐Ÿ“Š Expected Output ``` ๐Ÿณ Claude-Flow Docker Validation Suite ======================================== ๐Ÿ“ฆ Phase 1: Installation & Build -------------------------------- Testing: NPM install... โœ“ PASS Testing: Node version... โœ“ PASS Testing: Build completed... โœ“ PASS Testing: Binary exists... โœ“ PASS ๐Ÿ”ง Phase 2: CLI Basic Commands ------------------------------ Testing: Help command... โœ“ PASS ... ======================================== ๐Ÿ“Š Test Results Summary ======================================== Total Tests: 50 Passed: 50 Failed: 0 โœ… All tests passed! ๐Ÿš€ Claude-Flow is ready for production release ``` ## ๐Ÿ”ง Troubleshooting ### Issue: Build fails in Docker ```bash # Clean build docker build --no-cache -f Dockerfile.test -t claude-flow-test ../.. ``` ### Issue: Permission errors ```bash # The Dockerfile uses a non-root user (testuser) # This is intentional to simulate real user environment # If you need root, modify the Dockerfile ``` ### Issue: Tests timeout ```bash # Increase timeout in validation script # Or run specific test phases individually docker exec -it claude-flow-test ./bin/claude-flow --help ``` ## ๐ŸŽฏ CI/CD Integration ### GitHub Actions Example ```yaml name: Docker Validation on: [push, pull_request] jobs: docker-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Build test container run: | cd tests/docker docker build -f Dockerfile.test -t claude-flow-test ../.. - name: Run validation suite run: | docker run --rm claude-flow-test \ sh -c "cd /home/testuser && tests/docker/run-validation.sh" ``` ## ๐Ÿ“ Adding New Tests To add new validation tests, edit `run-validation.sh`: ```bash test_command "Your test description" \ "./bin/claude-flow your-command" \ "expected-output-pattern" ``` ## ๐ŸŒ Multi-Platform Testing ```bash # Build for multiple platforms docker buildx build --platform linux/amd64,linux/arm64 \ -f Dockerfile.test -t claude-flow-test ../.. ``` ## ๐Ÿ”’ Security Testing The validation suite includes security tests: - API key redaction - Secure storage validation - Permission checks ## ๐Ÿ“š Related Documentation - [COMMAND-VERIFICATION-REPORT.md](../../docs/COMMAND-VERIFICATION-REPORT.md) - [INTEGRATION_COMPLETE.md](../../docs/INTEGRATION_COMPLETE.md) - [REASONINGBANK-INTEGRATION-COMPLETE.md](../../docs/REASONINGBANK-INTEGRATION-COMPLETE.md) ## ๐Ÿค Contributing When adding new features to claude-flow: 1. Add corresponding tests to `run-validation.sh` 2. Update the test coverage section in this README 3. Run full validation suite before submitting PR ## ๐Ÿ“ž Support For issues with Docker validation: - Check Docker logs: `docker logs claude-flow-test` - Review test output for specific failures - Open issue on GitHub with validation output