fix: auto-detect test service for --exit-code-from#36
Draft
fey wants to merge 2 commits into
Draft
Conversation
…mpose Projects with a separate `test` container (depends on running `app`) were getting false CI failures: when `test` exited with code 0, Docker Compose killed `app` via SIGTERM causing a non-zero exit without --exit-code-from. Added getTestService() that reads docker-compose.yml and returns 'test' if that service exists, otherwise falls back to 'app'. The detected service name is passed to --exit-code-from so CI reliably reflects the test outcome. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Проблема
Проекты с отдельным
test-контейнером получали ложныеFAILEDв CI.Сценарий:
testзавершается с кодом 0 (тесты прошли) → Docker Compose убиваетapp,caddy,dbчерез SIGTERM → они возвращают ненулевой код → без--exit-code-fromCompose сообщает об ошибке → CI падает.Цепочки зависимостей в таких проектах:
db → app → caddy → test.Решение
Добавлена функция
getTestService(), которая читаетdocker-compose.ymlи возвращает имя сервиса для--exit-code-from:test→'test''app'(текущее поведение для 66% проектов)js-yamlуже был импортирован вsrc/index.js.Контекст
Из 96 проектов Hexlet (ru/en/es):
app, тесты запускаются внутри него →--exit-code-from apptest→--exit-code-from testМиграция проектов не требуется — автодетект по имени сервиса покрывает оба паттерна.
Тесты
make test)test-контейнером (например,python_l4_task_manager_project)