fix(ci): dial the postgres service instead of job loopback
quality / changes (push) Successful in 7s
quality / commitlint (push) Skipped
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 23s
quality / web (push) Successful in 1m19s
quality / go (push) Successful in 1m16s
quality / postgres-integration (push) Failing after 2m46s
quality / legacy-compatibility (1.0.0) (push) Successful in 1m11s
quality / legacy-compatibility (2.56.2) (push) Successful in 1m34s
quality / bird2 (push) Successful in 26s
CD / quality (push) Failing after 9m9s
CD / publish (push) Skipped
quality / changes (push) Successful in 7s
quality / commitlint (push) Skipped
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 23s
quality / web (push) Successful in 1m19s
quality / go (push) Successful in 1m16s
quality / postgres-integration (push) Failing after 2m46s
quality / legacy-compatibility (1.0.0) (push) Successful in 1m11s
quality / legacy-compatibility (2.56.2) (push) Successful in 1m34s
quality / bird2 (push) Successful in 26s
CD / quality (push) Failing after 9m9s
CD / publish (push) Skipped
Интеграционные тесты ходили на 127.0.0.1 внутри контейнера job и сразу получали connection refused. DSN указывает на сервис postgres, скрипт ждёт открытия TCP до 90 секунд. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3e46681263
commit
e755974273
2 files changed
+28
-1
No files matched your search
@@ -3,6 +3,31 @@ set -euo pipefail
|
||||
|
||||
: "${EVOBGP_TEST_DATABASE_URL:?PostgreSQL integration tests require EVOBGP_TEST_DATABASE_URL}"
|
||||
|
||||
# The Gitea job container does not publish the service onto its own loopback.
|
||||
# Wait until the DSN host accepts TCP so a slow postmaster is not a test failure.
|
||||
python3 - <<'PY'
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
raw = os.environ["EVOBGP_TEST_DATABASE_URL"]
|
||||
parsed = urlparse(raw)
|
||||
host = parsed.hostname or "127.0.0.1"
|
||||
port = parsed.port or 5432
|
||||
deadline = time.time() + 90
|
||||
last = "no attempt"
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
with socket.create_connection((host, port), timeout=2):
|
||||
print(f"postgres tcp open at {host}:{port}", flush=True)
|
||||
raise SystemExit(0)
|
||||
except OSError as exc:
|
||||
last = str(exc)
|
||||
time.sleep(2)
|
||||
raise SystemExit(f"postgres not accepting TCP at {host}:{port} after 90s: {last}")
|
||||
PY
|
||||
|
||||
assert_passes() {
|
||||
local result_file="$1" package="$2" label="$3"
|
||||
shift 3
|
||||
|
||||
Reference in new issue
Block a user