Repository navigation
fix(up): honor -t when an attached up stops the application - #14395
Merged
Merged
Conversation
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
htoyoda18
marked this pull request as ready for review
October 26, 2026 19:51
ndeloof
enabled auto-merge (rebase)
October 27, 2026 07:45
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What this PR does
When an attached
docker compose upstops the application itself, on Ctrl+C or on--abort-on-container-exit/--exit-code-from, it ignored-t/--timeoutand waited for each service'sstop_grace_period(or the engine default). The flag is documented as the shutdown timeout "when attached", so this PR passes the-tvalue to those stops. Without-t, nothing changes.Related issue
Fixes #14394
Changes made
pkg/compose/up.go:stopApplication(Ctrl+C and abort on container exit) andstopLateStarter(a service that starts after termination began) now setTimeout: u.options.Create.Timeoutin theirapi.StopOptions. This is the value-talready fills. It is nil when-tis not given, so the current behavior is unchanged in that case.pkg/compose/up_test.go: addTestUpSessionStopsWithUpTimeout, which checks that both stops pass the-tvalue toContainerStop. Before the fix, both subtests failed with an emptyTimeout.pkg/e2e/cascade_test.go,pkg/e2e/testdata/TestCascadeStopHonorsTimeout/compose.yaml: add a regression scenario.up -t 1 --abort-on-container-exit --exit-code-from testsmust end with exit code 3 within 60s while another service ignores SIGTERM and hasstop_grace_period: 2m. Before the fix it hit the 60s bound; now it finishes in ~3.5s. The Ctrl+C path goes through the samestopApplication, but the Scenario DSL cannot send signals, so it is covered by the unit test only.Testing done
make testmake e2e-composeormake e2e-compose-standalonemake lintmake fmtAI tool used (if applicable)
AI Tool:
Additional context
(not mandatory) A picture of a cute animal, if possible in relation to what you did