Skip to content

Commit 56c89ea

Browse files
committed
integration: fix rootless tests
Signed-off-by: CrazyMax <[email protected]>
1 parent 06d51f9 commit 56c89ea

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

util/testutil/integration/sandbox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func newSandbox(ctx context.Context, w Worker, mirror string, mv matrixValue) (s
126126
}
127127

128128
func RootlessSupported(uid int) bool {
129-
cmd := exec.Command("sudo", "-E", "-u", fmt.Sprintf("#%d", uid), "-i", "--", "exec", "unshare", "-U", "true") //nolint:gosec // test utility
129+
cmd := exec.Command("sudo", "-u", fmt.Sprintf("#%d", uid), "-i", "--", "exec", "unshare", "-U", "true") //nolint:gosec // test utility
130130
b, err := cmd.CombinedOutput()
131131
if err != nil {
132132
bklog.L.Warnf("rootless mode is not supported on this host: %v (%s)", err, string(b))

util/testutil/workers/containerd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ disabled_plugins = ["cri"]
168168
containerdArgs := []string{c.Containerd, "--config", configFile}
169169
rootlessKitState := filepath.Join(tmpdir, "rootlesskit-containerd")
170170
if rootless {
171-
containerdArgs = append(append([]string{"sudo", "-E", "-u", fmt.Sprintf("#%d", c.UID), "-i",
171+
containerdArgs = append(append([]string{"sudo", "-u", fmt.Sprintf("#%d", c.UID), "-i",
172172
fmt.Sprintf("CONTAINERD_ROOTLESS_ROOTLESSKIT_STATE_DIR=%s", rootlessKitState),
173173
// Integration test requires the access to localhost of the host network namespace.
174174
// TODO: remove these configurations
@@ -211,7 +211,7 @@ disabled_plugins = ["cri"]
211211
if err != nil {
212212
return nil, nil, err
213213
}
214-
buildkitdArgs = append([]string{"sudo", "-E", "-u", fmt.Sprintf("#%d", c.UID), "-i", "--", "exec",
214+
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", c.UID), "-i", "--", "exec",
215215
"nsenter", "-U", "--preserve-credentials", "-m", "-t", fmt.Sprintf("%d", pid)},
216216
append(buildkitdArgs, "--containerd-worker-snapshotter=native")...)
217217
}

util/testutil/workers/oci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (s *OCI) New(ctx context.Context, cfg *integration.BackendConfig) (integrat
6666
return nil, nil, errors.Errorf("unsupported id pair: uid=%d, gid=%d", s.UID, s.GID)
6767
}
6868
// TODO: make sure the user exists and subuid/subgid are configured.
69-
buildkitdArgs = append([]string{"sudo", "-E", "-u", fmt.Sprintf("#%d", s.UID), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
69+
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.UID), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
7070
}
7171

7272
var extraEnv []string

util/testutil/workers/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ func runBuildkitd(ctx context.Context, conf *integration.BackendConfig, args []s
5454

5555
address = getBuildkitdAddr(tmpdir)
5656

57-
args = append(args, "--root", tmpdir, "--addr", address, "--debug")
57+
args = append(args, "--root", tmpdir, "--addr", address, "--otel-socket-path", getTraceSocketPath(tmpdir), "--debug")
5858
cmd := exec.Command(args[0], args[1:]...) //nolint:gosec // test utility
59-
cmd.Env = append(os.Environ(), "BUILDKIT_DEBUG_EXEC_OUTPUT=1", "BUILDKIT_DEBUG_PANIC_ON_ERROR=1", "BUILDKIT_TRACE_SOCKET="+getTraceSocketPath(tmpdir), "TMPDIR="+filepath.Join(tmpdir, "tmp"))
59+
cmd.Env = append(os.Environ(), "BUILDKIT_DEBUG_EXEC_OUTPUT=1", "BUILDKIT_DEBUG_PANIC_ON_ERROR=1", "TMPDIR="+filepath.Join(tmpdir, "tmp"))
6060
cmd.Env = append(cmd.Env, extraEnv...)
6161
cmd.SysProcAttr = getSysProcAttr()
6262

0 commit comments

Comments
 (0)