diff options
author | Adin Scannell <ascannell@google.com> | 2020-11-30 13:38:31 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-30 13:40:23 -0800 |
commit | 3a60bc47a082d5e9ef4903d48ef3bdb505eb8b6e (patch) | |
tree | 8e259620aed54595926a4b60705781fed52c6bed /pkg/test/criutil | |
parent | 4fd71a7b20d53ba070bd2d937bb980991305b19d (diff) |
Ensure containerd is used from installed location.
Currently, if containerd is installed locally via tools/installers/containerd,
then it will not necessarily be used if containerd is installed in the system
path. This means that the existing containerd tests are all likely broken.
Also, use libbtrfs-dev instead of btrfs-tools, which is not actually required.
PiperOrigin-RevId: 344879109
Diffstat (limited to 'pkg/test/criutil')
-rw-r--r-- | pkg/test/criutil/criutil.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/test/criutil/criutil.go b/pkg/test/criutil/criutil.go index 70945f234..e41769017 100644 --- a/pkg/test/criutil/criutil.go +++ b/pkg/test/criutil/criutil.go @@ -54,14 +54,20 @@ func ResolvePath(executable string) string { } } + // Favor /usr/local/bin, if it exists. + localBin := fmt.Sprintf("/usr/local/bin/%s", executable) + if _, err := os.Stat(localBin); err == nil { + return localBin + } + // Try to find via the path. - guess, err := exec.LookPath(executable) + guess, _ := exec.LookPath(executable) if err == nil { return guess } - // Return a default path. - return fmt.Sprintf("/usr/local/bin/%s", executable) + // Return a bare path; this generates a suitable error. + return executable } // NewCrictl returns a Crictl configured with a timeout and an endpoint over |