hack: pass DBUS_SESSION_BUS_ADDRESS to the integration test suite

The test suite is executed via "env -i" with an explicit allow-list of
environment variables, so DBUS_SESSION_BUS_ADDRESS (exported by
.integration-daemon-start in rootless-systemd mode) never reached the
test binaries, nor the daemons they spawn via internal/testutil/daemon
("sudo --preserve-env"). Without it, runc inside those daemons cannot
detect the systemd user manager ("busctl --user" fails with the
per-daemon XDG_RUNTIME_DIR), assumes a rootful systemd, and fails to
create the container scope on the system bus:

    unable to start unit "docker-<id>.scope" ...: Permission denied

Also skip TestRunWithAlternativeContainerdShim in rootless-systemd
mode: the daemon only passes the SystemdCgroup option to the stock
runc runtime, so with an ad-hoc shim name runc falls back to the
cgroupfs driver and treats the systemd-style cgroupsPath as a literal
path, which cannot be created by a rootless daemon.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2026-07-09 17:19:26 +09:00
parent 438b5bea26
commit d1d7735c30
2 changed files with 6 additions and 0 deletions

View File

@@ -195,6 +195,7 @@ test_env() {
HOME="$ABS_DEST/fake-HOME" go telemetry off
env -i \
DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" \
DEST="$ABS_DEST" \
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
DOCKER_BUILDKIT="$DOCKER_BUILDKIT" \

View File

@@ -207,6 +207,11 @@ func TestRunConsoleSize(t *testing.T) {
func TestRunWithAlternativeContainerdShim(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon)
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
// The daemon only passes the SystemdCgroup option to the stock runc
// runtime; with an ad-hoc shim name, runc falls back to the cgroupfs
// driver and treats the systemd-style cgroupsPath ("user.slice:docker:ID")
// as a literal path, which cannot be created by a rootless daemon.
skip.If(t, testEnv.IsRootless() && testEnv.DaemonInfo.CgroupDriver == "systemd", "alternative shims do not support the systemd cgroup driver in rootless mode")
ctx := testutil.StartSpan(baseContext, t)