- Add production setup scripts for automated deployment - Include monitoring setup and configuration validation - Add legacy setup scripts for various Linux distributions - Implement Bitwarden integration for secure credential management - Add development and production environment setup - Include comprehensive management tools and utilities - Add shell script library with common functions Provides complete automation for setup, deployment, and management of FetchML platform in development and production environments.
67 lines
1.6 KiB
Bash
Executable file
67 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
echo "=== Test Tools Harness ==="
|
|
|
|
# Function to check if Redis is running, start temporary instance if needed
|
|
ensure_redis() {
|
|
if ! redis-cli ping >/dev/null 2>&1; then
|
|
echo "Starting temporary Redis instance..."
|
|
redis-server --daemonize yes --port 6379
|
|
sleep 2
|
|
if ! redis-cli ping >/dev/null 2>&1; then
|
|
echo "Failed to start Redis"
|
|
exit 1
|
|
fi
|
|
echo "Redis started successfully"
|
|
# Set up cleanup trap
|
|
trap 'echo "Stopping temporary Redis..."; redis-cli shutdown || true' EXIT
|
|
else
|
|
echo "Redis is already running"
|
|
fi
|
|
}
|
|
|
|
# Step 1: Build Go binaries
|
|
echo "Building Go binaries..."
|
|
go build -o bin/api-server ./cmd/api-server
|
|
go build -o bin/worker ./cmd/worker
|
|
go build -o bin/data_manager ./cmd/data_manager
|
|
go build -o bin/user_manager ./cmd/user_manager
|
|
|
|
# Step 2: Build Zig CLI
|
|
echo "Building Zig CLI..."
|
|
cd cli
|
|
zig build
|
|
cd ..
|
|
|
|
# Step 3: Ensure Redis is running
|
|
ensure_redis
|
|
|
|
# Step 4: Run Go tests
|
|
echo "Running Go tests..."
|
|
go test ./...
|
|
|
|
# Step 5: Run Zig tests
|
|
echo "Running Zig CLI tests..."
|
|
cd cli
|
|
zig test
|
|
cd ..
|
|
|
|
# Step 6: Run Go E2E tests (Redis is already available)
|
|
echo "Running Go E2E tests..."
|
|
go test ./tests/e2e/...
|
|
|
|
# Step 7: Smoke test API server and CLI
|
|
echo "Running smoke test..."
|
|
# Start API server in background on different port
|
|
./bin/api-server -config configs/config.yaml -port 19101 -no-tls > /tmp/api-server.log 2>&1 &
|
|
API_PID=$!
|
|
sleep 2
|
|
|
|
# Test CLI status
|
|
./cli/zig-out/bin/ml status -server http://localhost:19101
|
|
|
|
# Clean up
|
|
kill $API_PID 2>/dev/null || true
|
|
|
|
echo "=== All tests completed successfully ==="
|