#!/bin/bash # Test script for Temporal Scheduler Integration # This script tests the complete Phase 2 implementation set -e echo "๐Ÿš€ Testing Temporal Scheduler Integration - Phase 2" echo "==================================================" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Function to print status print_status() { echo -e "${GREEN}โœ… $1${NC}" } print_warning() { echo -e "${YELLOW}โš ๏ธ $1${NC}" } print_error() { echo -e "${RED}โŒ $1${NC}" } # Check prerequisites echo "๐Ÿ” Checking prerequisites..." # Check if Temporal CLI is installed if ! command -v temporal &> /dev/null; then print_error "Temporal CLI not found. Install with: brew install temporal" exit 1 fi print_status "Temporal CLI found" # Check if Go service is built if [ ! -f "temporal-service/temporal-service" ]; then print_error "Temporal service not built. Run: cd temporal-service && ./build.sh" exit 1 fi print_status "Temporal service binary found" # Check if Rust executor is built if ! command -v goose-scheduler-executor &> /dev/null; then print_error "goose-scheduler-executor not found in PATH" print_warning "Building and installing executor..." cargo build --release --bin goose-scheduler-executor cp target/release/goose-scheduler-executor /usr/local/bin/ fi print_status "goose-scheduler-executor found" # Build the goose library echo "๐Ÿ”จ Building goose library..." cargo build --lib -p goose print_status "Goose library built successfully" # Test 1: Verify trait compilation echo "๐Ÿงช Test 1: Verify trait abstraction compiles..." cargo check --lib -p goose print_status "Trait abstraction compiles correctly" # Test 2: Verify executor binary works echo "๐Ÿงช Test 2: Test executor binary help..." if goose-scheduler-executor --help > /dev/null 2>&1; then print_status "Executor binary responds to --help" else print_error "Executor binary failed help test" exit 1 fi # Test 3: Create a test recipe echo "๐Ÿงช Test 3: Creating test recipe..." TEST_RECIPE_DIR="/tmp/goose-temporal-test" mkdir -p "$TEST_RECIPE_DIR" cat > "$TEST_RECIPE_DIR/test-recipe.yaml" << 'EOF' version: "1.0.0" title: "Temporal Test Recipe" description: "A simple test recipe for Temporal scheduler" prompt: "Say hello and tell me the current time" EOF print_status "Test recipe created at $TEST_RECIPE_DIR/test-recipe.yaml" # Test 4: Verify the integration compiles with all features echo "๐Ÿงช Test 4: Full compilation test..." cargo build --workspace --exclude goose-server --exclude goose-cli print_status "Full workspace builds successfully" echo "" echo "๐ŸŽ‰ Phase 2 Integration Tests Complete!" echo "======================================" print_status "All tests passed successfully" echo "" echo "๐Ÿ“‹ What was tested:" echo " โœ… Prerequisites (Temporal CLI, Go service, Rust executor)" echo " โœ… Goose library compilation" echo " โœ… Trait abstraction" echo " โœ… Executor binary functionality" echo " โœ… Test recipe creation" echo " โœ… Full workspace compilation" echo "" echo "๐Ÿš€ Ready for Phase 3: Migration & Testing" echo "" echo "To test the Temporal scheduler manually:" echo " 1. Set environment: export GOOSE_SCHEDULER_TYPE=temporal" echo " 2. Start services: cd temporal-service && ./start.sh" echo " 3. Use the scheduler factory in your code" echo "" print_status "Phase 2 implementation is ready!"