testien nopeutus
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 27s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Failing after 51s
unit-tests Bats test report
CI Feature / Bats tests (push) Failing after 1m32s
CI Feature / Report Summary (push) Successful in 5s

This commit is contained in:
moilanik
2026-06-20 13:44:36 +03:00
parent a039e6637e
commit cd6ff8830c
4 changed files with 31 additions and 38 deletions
+2 -24
View File
@@ -13,30 +13,13 @@ _free_port() {
python3 -c "import socket; s=socket.socket(); s.bind(('',0)); print(s.getsockname()[1]); s.close()"
}
_kill_port() {
local pids
pids=$(lsof -ti ":$MOCK_PORT" 2>/dev/null) || true
[ -n "$pids" ] && kill $pids 2>/dev/null || true
sleep 0.5
pids=$(lsof -ti ":$MOCK_PORT" 2>/dev/null) || true
[ -n "$pids" ] && kill -9 $pids 2>/dev/null || true
}
_wait_port_free() {
local i=0
while lsof -ti ":$MOCK_PORT" >/dev/null 2>&1 && [ $i -lt 50 ]; do
sleep 0.1
i=$((i + 1))
done
}
_wait_port_ready() {
local i=0
while [ $i -lt 50 ]; do
while [ $i -lt 10 ]; do
if nc -z localhost "$MOCK_PORT" 2>/dev/null; then
return 0
fi
sleep 0.2
sleep 0.1
i=$((i + 1))
done
return 1
@@ -73,9 +56,6 @@ mock_start() {
echo "$MOCK_RESPONSE_CODE" >> "$MOCK_CONFIG_FILE"
fi
_kill_port
_wait_port_free
nohup python3 "$(dirname "${BASH_SOURCE[0]}")/mock-server.py" "$MOCK_PORT" "$MOCK_CONFIG_FILE" "$MOCK_REQUEST_FILE" \
</dev/null >/dev/null 2>&1 &
MOCK_PID=$!
@@ -84,8 +64,6 @@ mock_start() {
mock_stop() {
[ -n "${MOCK_PID:-}" ] && kill -9 "$MOCK_PID" 2>/dev/null || true
_kill_port
_wait_port_free
[ -n "${MOCK_REQUEST_FILE:-}" ] && rm -f "${MOCK_REQUEST_FILE}" 2>/dev/null || true
[ -n "${MOCK_SEQUENCE_FILE:-}" ] && rm -f "${MOCK_SEQUENCE_FILE}" 2>/dev/null || true
[ -n "${MOCK_SEQUENCE_FILE:-}" ] && rm -f "${MOCK_SEQUENCE_FILE}.idx" 2>/dev/null || true