2022-09-12 23:38:43 +02:00
|
|
|
Feature: Stop
|
|
|
|
|
|
|
|
Background:
|
|
|
|
Given a compose file
|
|
|
|
"""
|
|
|
|
services:
|
|
|
|
should_fail:
|
|
|
|
image: alpine
|
2023-08-03 20:49:59 +02:00
|
|
|
command: ['sh', '-c', 'exit 123']
|
2022-09-12 23:38:43 +02:00
|
|
|
sleep: # will be killed
|
|
|
|
image: alpine
|
|
|
|
command: ping localhost
|
2022-12-02 15:34:06 +01:00
|
|
|
init: true
|
2022-09-12 23:38:43 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Cascade stop
|
|
|
|
When I run "compose up --abort-on-container-exit"
|
2023-08-03 20:49:59 +02:00
|
|
|
Then the output contains "should_fail-1 exited with code 123"
|
2022-09-12 23:38:43 +02:00
|
|
|
And the output contains "Aborting on container exit..."
|
2023-08-03 20:49:59 +02:00
|
|
|
And the exit code is 123
|
2022-09-12 23:38:43 +02:00
|
|
|
|
|
|
|
Scenario: Exit code from
|
2023-08-03 20:49:59 +02:00
|
|
|
When I run "compose up --exit-code-from should_fail"
|
|
|
|
Then the output contains "should_fail-1 exited with code 123"
|
2022-09-12 23:38:43 +02:00
|
|
|
And the output contains "Aborting on container exit..."
|
2023-08-03 20:49:59 +02:00
|
|
|
And the exit code is 123
|
|
|
|
|
|
|
|
# TODO: this is currently not working propagating the exit code properly
|
|
|
|
#Scenario: Exit code from (cascade stop)
|
|
|
|
# When I run "compose up --exit-code-from sleep"
|
|
|
|
# Then the output contains "should_fail-1 exited with code 123"
|
|
|
|
# And the output contains "Aborting on container exit..."
|
|
|
|
# And the exit code is 143
|
2022-09-12 23:38:43 +02:00
|
|
|
|
|
|
|
Scenario: Exit code from unknown service
|
|
|
|
When I run "compose up --exit-code-from unknown"
|
|
|
|
Then the output contains "no such service: unknown"
|
|
|
|
And the exit code is 1
|