-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.sh
More file actions
executable file
·46 lines (39 loc) · 1.38 KB
/
tests.sh
File metadata and controls
executable file
·46 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# tests.sh - uruchamia wszystkie testy jednostkowe i integracyjne w projekcie coboarding
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log() {
echo -e "${GREEN}[coBoarding]${NC} $1"
}
err() {
echo -e "${RED}[coBoarding]${NC} $1" >&2
}
log "Aktywacja środowiska wirtualnego..."
if [ -d "venv-py3.12" ]; then
source venv-py3.12/bin/activate
elif [ -d "venv-py3.11" ]; then
source venv-py3.11/bin/activate
elif [ -d "venv" ]; then
source venv/bin/activate
else
err "Brak środowiska wirtualnego! Uruchom najpierw install.sh."
exit 1
fi
if [ "$LOCAL_TEST" = "1" ]; then
log "Tryb testowania lokalnego (LOCAL_TEST=1): testy korzystają z localhost i lokalnych portów."
else
log "Tryb testowania Docker/network: testy korzystają z nazw usług Docker Compose."
fi
log "Wyszukiwanie i uruchamianie testów Python (pytest)..."
if command -v pytest &>/dev/null; then
pytest containers/test-runner/tests/ --maxfail=5 --disable-warnings -v || err "Niektóre testy pytest nie przeszły!"
else
log "pytest nie jest zainstalowany. Instaluję..."
pip install pytest && pytest containers/test-runner/tests/ --maxfail=5 --disable-warnings -v || err "Niektóre testy pytest nie przeszły!"
fi
log "Wyszukiwanie i uruchamianie testów shell (test_*.sh)..."
find . -type f -name 'test_*.sh' -exec bash {} \;
log "Wszystkie testy zakończone."