fix: add-host for stand e2e under Docker host network (IFT DNS)
CI / deploy-ift (push) Successful in 2m4s
CI / test (push) Successful in 6m8s
CI / e2e-ift (push) Failing after 3m27s
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped

This commit is contained in:
2026-07-20 01:45:10 +03:00
parent c760070611
commit 2440c50330
3 changed files with 30 additions and 4 deletions
+26
View File
@@ -44,6 +44,31 @@ echo " ADMIN_API_HOST=${ADMIN_API_HOST}"
echo " WS_HOST=${WS_HOST}"
echo " ADMIN_WS_HOST=${ADMIN_WS_HOST}"
# Docker Desktop/WSL: --network=host часто НЕ наследует /etc/hosts стенда,
# из‑за чего CT remote не резолвит *.ift.eventhub.local (health timeout 30s).
docker_add_hosts=()
for url in "${API_HOST}" "${ADMIN_API_HOST}" "${WS_HOST}" "${ADMIN_WS_HOST}"; do
host="$(python3 -c 'from urllib.parse import urlparse; import sys; print(urlparse(sys.argv[1]).hostname or "")' "${url}")"
[[ -n "${host}" ]] || continue
# уже добавили этот host
skip=0
for existing in "${docker_add_hosts[@]:-}"; do
case "${existing}" in
--add-host="${host}:"*) skip=1; break ;;
esac
done
[[ "${skip}" -eq 1 ]] && continue
ip="$(getent ahostsv4 "${host}" 2>/dev/null | awk '{print $1; exit}' || true)"
if [[ -z "${ip}" ]]; then
ip="$(getent hosts "${host}" 2>/dev/null | awk '{print $1; exit}' || true)"
fi
if [[ -z "${ip}" ]]; then
ip=host-gateway
fi
echo " docker --add-host ${host}:${ip}"
docker_add_hosts+=(--add-host="${host}:${ip}")
done
IMAGE="eventhub-api-tests:local"
REG_IMAGE=""
if [[ -n "${GITHUB_SHA:-}" ]]; then
@@ -90,6 +115,7 @@ if [[ "${have_image}" -ne 1 ]]; then
fi
docker run --rm --network=host \
${docker_add_hosts[@]+"${docker_add_hosts[@]}"} \
-e CT_MODE=remote \
-e "API_HOST=${API_HOST}" \
-e "ADMIN_API_HOST=${ADMIN_API_HOST}" \
+2 -2
View File
@@ -149,10 +149,10 @@ ct_mode() ->
wait_for_remote() ->
URL = api_test_runner:get_admin_url() ++ "/admin/health",
ct:pal("Waiting for remote API: ~s", [URL]),
wait_for_health(URL, 30).
wait_for_health(URL, 90).
wait_for_health(_URL, 0) ->
ct:fail("Remote API did not start within 30 seconds");
ct:fail("Remote API did not start within 90 seconds");
wait_for_health(URL, Retries) ->
case httpc:request(get, {URL, []}, [{timeout, 5000}, {ssl, [{verify, verify_none}]}], []) of
{ok, {{_, 200, _}, _, _}} -> ok;
+2 -2
View File
@@ -177,10 +177,10 @@ ct_mode() ->
wait_for_remote() ->
URL = api_test_runner:get_base_url() ++ "/health",
ct:pal("Waiting for remote API: ~s", [URL]),
wait_for_health(URL, 30).
wait_for_health(URL, 90).
wait_for_health(_URL, 0) ->
ct:fail("Remote API did not start within 30 seconds");
ct:fail("Remote API did not start within 90 seconds");
wait_for_health(URL, Retries) ->
case httpc:request(get, {URL, []}, [{timeout, 5000}, {ssl, [{verify, verify_none}]}], []) of
{ok, {{_, 200, _}, _, _}} -> ok;