- Update all scripts to use 'docker compose' instead of 'docker-compose' - Fix compose file paths after consolidation (test.yml, prod.yml) - Update cleanup.sh to handle --profile debug and --profile smoke - Update test fixtures to reference consolidated compose files
55 lines
1.4 KiB
Bash
Executable file
55 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# Test script for native libraries with Redis via docker compose
|
|
# Usage: ./scripts/test-native-with-redis.sh
|
|
|
|
set -e
|
|
|
|
echo "=== FetchML Native Library Test with Redis ==="
|
|
echo ""
|
|
|
|
# Check if native libraries are built
|
|
if [ ! -f "native/build/libqueue_index.so" ] && [ ! -f "native/build/libqueue_index.dylib" ]; then
|
|
echo "Building native libraries..."
|
|
make native-build
|
|
fi
|
|
|
|
compose_cmd=$(command -v docker compose >/dev/null 2>&1 && echo "docker compose" || echo "docker compose")
|
|
|
|
# Start Redis via docker compose
|
|
echo "Starting Redis..."
|
|
cd deployments
|
|
$compose_cmd -f docker compose.dev.yml up -d redis
|
|
cd ..
|
|
|
|
# Wait for Redis to be ready
|
|
echo "Waiting for Redis to be ready..."
|
|
sleep 2
|
|
until docker exec ml-experiments-redis redis-cli ping | grep -q PONG; do
|
|
echo " Redis not ready yet, waiting..."
|
|
sleep 1
|
|
done
|
|
echo " Redis is ready!"
|
|
echo ""
|
|
|
|
# Run tests with native_libs build tag
|
|
echo "Running tests with -tags native_libs..."
|
|
CGO_ENABLED=1 go test -tags native_libs -v ./tests/benchmarks/... 2>&1 | head -100
|
|
|
|
TEST_EXIT=${PIPESTATUS[0]}
|
|
|
|
echo ""
|
|
echo "=== Test Summary ==="
|
|
if [ $TEST_EXIT -eq 0 ]; then
|
|
echo "✅ All tests passed with native libraries enabled"
|
|
else
|
|
echo "❌ Tests failed with exit code: $TEST_EXIT"
|
|
fi
|
|
|
|
# Cleanup
|
|
echo ""
|
|
echo "Stopping Redis..."
|
|
cd deployments
|
|
$compose_cmd -f docker compose.dev.yml stop redis
|
|
cd ..
|
|
|
|
exit $TEST_EXIT
|