Verbessere docker test-integration.sh für lokales Testen
- Verbessert die Erkennung von Docker/Docker Compose - Vereinfacht die Tests mit fokus auf die Front-Backend Verbindung - Verbessert Lesbarkeit durch bessere Formatierung 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
37f2519140
commit
4e0fa33dee
@ -22,18 +22,15 @@ echo "Test directory: $SCRIPT_DIR" | tee -a "$TEST_LOG"
|
||||
echo "Parent directory: $PARENT_DIR" | tee -a "$TEST_LOG"
|
||||
echo "Log file: $TEST_LOG" | tee -a "$TEST_LOG"
|
||||
|
||||
# Check if Docker is available
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo -e "${RED}Error: Docker is not installed or not in PATH${NC}" | tee -a "$TEST_LOG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to run docker compose (handles both docker-compose and docker compose syntax)
|
||||
run_docker_compose() {
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
docker-compose "$@"
|
||||
else
|
||||
elif command -v docker &> /dev/null && docker compose version &> /dev/null; then
|
||||
docker compose "$@"
|
||||
else
|
||||
echo -e "${RED}Error: Neither docker-compose nor docker compose is available${NC}" | tee -a "$TEST_LOG"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
@ -115,6 +112,7 @@ echo -e "${YELLOW}Performing basic integration tests...${NC}" | tee -a "$TEST_LO
|
||||
# Test 1: Frontend can fetch API data (printers endpoint)
|
||||
echo "Test 1: Frontend can fetch data from backend API..." | tee -a "$TEST_LOG"
|
||||
frontend_container_id=$(docker ps -qf "name=myp-frontend-test")
|
||||
|
||||
if [ -z "$frontend_container_id" ]; then
|
||||
echo -e "${RED}Failed to find frontend container${NC}" | tee -a "$TEST_LOG"
|
||||
run_docker_compose -f "$SCRIPT_DIR/test-env.yml" down >> "$TEST_LOG" 2>&1
|
||||
|
Loading…
x
Reference in New Issue
Block a user