Compare commits
17 Commits
4844b63c16
...
dev-2026-0
| Author | SHA1 | Date | |
|---|---|---|---|
| ef8a4ae994 | |||
| 4c54503a81 | |||
| 62d339b58c | |||
| 23cad37e03 | |||
| 779fb7b387 | |||
| 48c54c2f32 | |||
| f5294f5290 | |||
| 11d0865fd3 | |||
| 14f4fb8d16 | |||
| cc2d4aea5c | |||
| 5a45a72dcf | |||
| ba3909ec68 | |||
| 805dc2fe32 | |||
| 81fe00bfb8 | |||
| 4707f0614c | |||
| c76c25fb5b | |||
| 1bb11ca92b |
Submodule HarborForge.Backend.Test updated: 477419cb57...b505fa7b35
Submodule HarborForge.Frontend.Test updated: b46e242cb7...df05820a95
@@ -74,6 +74,9 @@ services:
|
||||
restart: "no"
|
||||
environment:
|
||||
VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000}
|
||||
VITE_WIZARD_PORT: ${WIZARD_PORT:-8080}
|
||||
FRONTEND_DEV_MODE: ${FRONTEND_DEV_MODE:-1}
|
||||
NODE_ENV: development
|
||||
ports:
|
||||
- "127.0.0.1:${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}"
|
||||
depends_on:
|
||||
|
||||
@@ -72,6 +72,9 @@ services:
|
||||
environment:
|
||||
# Use internal service name
|
||||
VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000}
|
||||
VITE_WIZARD_PORT: ${WIZARD_PORT:-8080}
|
||||
FRONTEND_DEV_MODE: ${FRONTEND_DEV_MODE:-1}
|
||||
NODE_ENV: development
|
||||
networks:
|
||||
- test-network
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#!/bin/bash
|
||||
# Run frontend test with optional port exposure
|
||||
# Usage: ./run-test-frontend.sh [--expose-port {on|off}]
|
||||
# Default: off
|
||||
#
|
||||
# --expose-port on: Keep services running after test (manual cleanup required)
|
||||
# --expose-port off: Auto cleanup after test (default)
|
||||
# Default:
|
||||
# --expose-port off: Auto cleanup after test
|
||||
|
||||
set -e
|
||||
|
||||
@@ -54,28 +52,44 @@ fi
|
||||
|
||||
echo "📦 Using compose file: $COMPOSE_FILE"
|
||||
|
||||
run_quiet() {
|
||||
local label="$1"
|
||||
shift
|
||||
local log_file
|
||||
log_file=$(mktemp)
|
||||
if "$@" >"$log_file" 2>&1; then
|
||||
rm -f "$log_file"
|
||||
return 0
|
||||
fi
|
||||
echo "❌ ${label} failed"
|
||||
echo "--- ${label} log ---"
|
||||
tail -n 200 "$log_file"
|
||||
rm -f "$log_file"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Clean any previous containers first
|
||||
echo "🧹 Cleaning up previous containers..."
|
||||
docker compose -f "$COMPOSE_FILE" down -v 2>/dev/null || true
|
||||
docker compose -f "$COMPOSE_FILE" down -v >/dev/null 2>&1 || true
|
||||
|
||||
# Build frontend with correct API base URL (force no cache, remove image first)
|
||||
echo "🔨 Building frontend..."
|
||||
docker rmi harborforge-test-frontend:dev 2>/dev/null || true
|
||||
docker compose -f "$COMPOSE_FILE" build --no-cache --build-arg VITE_API_BASE=http://backend:8000 frontend
|
||||
docker rmi harborforge-test-frontend:dev >/dev/null 2>&1 || true
|
||||
run_quiet "frontend build" docker compose -f "$COMPOSE_FILE" build --no-cache --build-arg VITE_API_BASE=http://backend:8000 frontend
|
||||
|
||||
# Build backend (force no cache, remove image first)
|
||||
echo "🔨 Building backend..."
|
||||
docker rmi harborforge-test-backend:dev 2>/dev/null || true
|
||||
docker compose -f "$COMPOSE_FILE" build --no-cache backend
|
||||
docker rmi harborforge-test-backend:dev >/dev/null 2>&1 || true
|
||||
run_quiet "backend build" docker compose -f "$COMPOSE_FILE" build --no-cache backend
|
||||
|
||||
# Build test runner (force no cache, remove image first)
|
||||
echo "🔨 Building test runner..."
|
||||
docker rmi harborforge-test-runner:dev 2>/dev/null || true
|
||||
docker compose -f "$COMPOSE_FILE" build --no-cache test
|
||||
docker rmi harborforge-test-runner:dev >/dev/null 2>&1 || true
|
||||
run_quiet "test runner build" docker compose -f "$COMPOSE_FILE" build --no-cache test
|
||||
|
||||
# Start services
|
||||
echo "📦 Starting services..."
|
||||
docker compose -f "$COMPOSE_FILE" up -d
|
||||
run_quiet "service startup" docker compose -f "$COMPOSE_FILE" up -d
|
||||
|
||||
# Wait for frontend to be ready
|
||||
echo "⏳ Waiting for services..."
|
||||
@@ -96,7 +110,7 @@ fi
|
||||
|
||||
echo "✅ Services ready!"
|
||||
|
||||
# Run test
|
||||
# Run test using the image default CMD so proxy startup stays inside Frontend.Test Dockerfile
|
||||
echo "🧪 Running test..."
|
||||
docker compose -f "$COMPOSE_FILE" run --rm -e WORKERS=1 test
|
||||
TEST_EXIT_CODE=$?
|
||||
@@ -108,7 +122,7 @@ if [[ "$EXPOSE_PORT" == "on" ]]; then
|
||||
echo " Use './run-test-frontend.sh --expose-port on' to cleanup"
|
||||
echo " Or manually: docker compose -f $COMPOSE_FILE down -v"
|
||||
echo ""
|
||||
|
||||
|
||||
if [ $TEST_EXIT_CODE -eq 0 ]; then
|
||||
echo "✅ Test passed!"
|
||||
else
|
||||
@@ -118,7 +132,7 @@ else
|
||||
echo ""
|
||||
echo "🧹 Cleaning up containers and volumes..."
|
||||
docker compose -f "$COMPOSE_FILE" down -v
|
||||
|
||||
|
||||
if [ $TEST_EXIT_CODE -eq 0 ]; then
|
||||
echo "✅ Test passed!"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user