MCPcopy Create free account
hub / github.com/containerd/nerdctl / ContainerdAddress

Method ContainerdAddress

pkg/testutil/testutil.go:279–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277}
278
279func (b *Base) ContainerdAddress() string {
280 b.T.Helper()
281 if IsDocker() {
282 b.T.Skip("ContainerdAddress() should not be called for non-nerdctl target")
283 }
284 if os.Geteuid() == 0 {
285 return defaults.DefaultAddress
286 }
287 xdr, err := rootlessutil.XDGRuntimeDir()
288 if err != nil {
289 b.T.Log(err)
290 xdr = fmt.Sprintf("/run/user/%d", os.Geteuid())
291 }
292 pidFile := filepath.Join(xdr, "containerd-rootless", "child_pid")
293 pidB, err := filesystem.ReadFile(pidFile)
294 if err != nil {
295 b.T.Fatal(err)
296 }
297 pidS := strings.TrimSpace(string(pidB))
298 return filepath.Join("/proc", pidS, "root", defaults.DefaultAddress)
299}
300
301func (b *Base) EnsureContainerStarted(con string) {
302 b.T.Helper()

Callers 1

TestIssue3781Function · 0.95

Calls 6

XDGRuntimeDirFunction · 0.92
ReadFileFunction · 0.92
IsDockerFunction · 0.70
HelperMethod · 0.65
SkipMethod · 0.65
LogMethod · 0.65

Tested by 1

TestIssue3781Function · 0.76