mirror of
https://github.com/docker/compose.git
synced 2026-11-21 23:50:17 +00:00
Follow-up to the report of the services a failed start interrupts: - When it is the wait itself that fails (the dependency is unhealthy, or exited with an error), the held service reads which condition was not met instead of an interruption by the internal name of the wait node. - Only the start phase reports what it gives up: the create phase stays silent as before. - An inspection cut short by the cancellation ends the wait as interrupted, and no longer marks the healthy dependency as failed. A caller canceled (Ctrl-C) at that point ends the wait as it always did. - Two nodes failing together each end their own row with their own error, whichever one cancels the phase, instead of leaving one on "Starting" or reading "interrupted" for a failure that was its own. - A replica whose start is behind it reads that only its post_start hooks were interrupted. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
47 lines
2.1 KiB
Go
47 lines
2.1 KiB
Go
//go:build e2e
|
|
|
|
/*
|
|
Copyright 2020 Docker Compose CLI authors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package e2e
|
|
|
|
import "testing"
|
|
|
|
// TestUpStartFailureReportsInterruptedServices locks docker/compose#14372: when
|
|
// a service fails to start, the services the command could not start because of
|
|
// it are reported as such. A service held by a depends_on wait, created but
|
|
// never started, used to be left on its last status with nothing saying why.
|
|
func TestUpStartFailureReportsInterruptedServices(t *testing.T) {
|
|
NewScenario(t, "up must say why a service is not started when another service failed to start").
|
|
Step("web fails to start, and api, held by the wait for db, is reported as not started",
|
|
ComposeCmd("up", "-d").MayFail(),
|
|
ExitCode(1),
|
|
ServiceState("api", "created"),
|
|
OutputContains(`not started: condition "service_healthy" of service "db" not reached: interrupted by the failure of`))
|
|
}
|
|
|
|
// TestUpUnhealthyDependencyNamesTheConditionNotMet locks what a service held by
|
|
// a wait reads when the dependency it waits for fails: the condition that was
|
|
// not met, not an interruption nor the internal name of the wait.
|
|
func TestUpUnhealthyDependencyNamesTheConditionNotMet(t *testing.T) {
|
|
NewScenario(t, "up must name the depends_on condition a dependency did not meet").
|
|
Step("db turns unhealthy, and api, held by the wait for it, is reported as not started",
|
|
ComposeCmd("up", "-d").MayFail(),
|
|
ExitCode(1),
|
|
ServiceState("api", "created"),
|
|
OutputContains(`not started: condition "service_healthy" of service "db" not met`),
|
|
OutputNotContains("wait:"))
|
|
}
|