compose/pkg/e2e
Guillaume Lours 9d444a667a
Some checks failed
ci / validate (lint) (push) Has been cancelled
ci / validate (validate-docs) (push) Has been cancelled
ci / validate (validate-go-mod) (push) Has been cancelled
ci / validate (validate-headers) (push) Has been cancelled
ci / binary (push) Has been cancelled
ci / bin-image-test (push) Has been cancelled
ci / test (push) Has been cancelled
ci / e2e (plugin, oldstable) (push) Has been cancelled
ci / e2e (standalone, oldstable) (push) Has been cancelled
ci / e2e (plugin, stable) (push) Has been cancelled
ci / e2e (standalone, stable) (push) Has been cancelled
merge / bin-image-prepare (push) Has been cancelled
merge / module-image (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
ci / binary-finalize (push) Has been cancelled
ci / coverage (push) Has been cancelled
ci / release (push) Has been cancelled
merge / bin-image (push) Has been cancelled
merge / desktop-edge-test (push) Has been cancelled
pre_start: support pre_start lifecycle hooks
runPreStart executes a service's pre_start hooks sequentially as
ephemeral containers that share the first non-running replica's
volumes via VolumesFrom and attach to the same networks. A non-zero
hook exit gates service start.

per_replica: false is the only currently supported mode; per_replica:
true is rejected up front. The donor replica is the lowest-numbered
one so the choice is deterministic. ContainerWait uses
WaitConditionNextExit, and the wait loop deterministically handles
the daemon's clean-close (nil on Error + exit code on Result) and
transport-error races to avoid spurious hook failures.

The log stream is opened before ContainerStart to avoid racing
AutoRemove on fast-exiting hooks, and runs under a derived context
so a daemon that keeps the connection open cannot deadlock the call.
Hook containers carry project/service/version labels; the two
cleanup paths force-remove the never-started container explicitly
and warn when removal fails.

pre_start runs once per service when no replica is already running
(initial up, force-recreate or spec change), and is skipped on
scale-up so additional replicas don't re-trigger the hooks.

Coverage: 11 unit tests (including scheduler-race stress) with
goroutine-leak verification via goleak, plus 10 E2E tests (success
path, hook failure gating start, build-image inheritance, idempotent
re-up, spec change, force-recreate, mid-sequence failure, ordering,
scale-up, scaled service).

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-06-30 10:49:04 +02:00
..
fixtures pre_start: support pre_start lifecycle hooks 2026-06-30 10:49:04 +02:00
assert.go
bridge_test.go
build_test.go
cancel_test.go
cascade_test.go
commit_test.go
compose_environment_test.go
compose_exec_test.go
compose_run_build_once_test.go
compose_run_test.go Normalize --no-TTY flag to --no-tty 2026-06-29 20:56:31 +02:00
compose_test.go
compose_up_test.go
config_test.go
configs_test.go
container_name_test.go
cp_test.go
e2e_config_plugin.go
e2e_config_standalone.go
env_file_test.go
exec_test.go
export_test.go
expose_test.go
framework.go
healthcheck_test.go
hooks_test.go pre_start: support pre_start lifecycle hooks 2026-06-30 10:49:04 +02:00
ipc_test.go
logs_test.go
main_test.go
model_test.go
networks_test.go
noDeps_test.go
orphans_test.go
pause_test.go
profiles_test.go
providers_test.go Fix rawsetenv nil-pointer guard for inherit-from-shell env vars 2026-06-23 15:01:33 +02:00
ps_test.go
publish_test.go
pull_test.go
recreate_no_deps_test.go
restart_test.go
scale_test.go
secrets_test.go
start_stop_test.go
up_test.go
volumes_test.go
wait_test.go
watch_test.go watch: do not rebuild depends_on services on file change 2026-06-19 11:23:50 +02:00