Skip to content

Commit

Permalink
remove unix scheme from containerd address
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman committed Sep 14, 2023
1 parent 061d521 commit d09921b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/containerd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func getAddress(fs afero.Fs, xdgRuntimeDir, defaultSocketPath string) (string, e
log.WithFields("path", candidate).Trace("trying containerd socket")
_, err := fs.Stat(candidate)
if err == nil {
addr = fmt.Sprintf("unix://%s", candidate)
addr = candidate
break
}
}
Expand Down
14 changes: 7 additions & 7 deletions internal/containerd/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
)

func Test_getContainerHostAddress(t *testing.T) {
func Test_getAddress(t *testing.T) {
type args struct {
containerHostEnvVar string
xdgRuntimeDir string
Expand All @@ -23,11 +23,11 @@ func Test_getContainerHostAddress(t *testing.T) {
{
name: "env vars trump default socket values",
args: args{
containerHostEnvVar: "unix:///somewhere/containerd.sock",
containerHostEnvVar: "/somewhere/containerd.sock",
xdgRuntimeDir: "/xdg-runtime",
defaultSocketPath: "/default/containerd.sock",
},
want: "unix:///somewhere/containerd.sock",
want: "/somewhere/containerd.sock",
wantErr: assert.NoError,
},

Expand All @@ -38,7 +38,7 @@ func Test_getContainerHostAddress(t *testing.T) {
xdgRuntimeDir: "/xdg-runtime",
defaultSocketPath: "/default/containerd.sock",
},
want: "unix:///proc/42/root/run/containerd/containerd.sock",
want: "/proc/42/root/run/containerd/containerd.sock",
wantErr: assert.NoError,
},
{
Expand All @@ -48,7 +48,7 @@ func Test_getContainerHostAddress(t *testing.T) {
xdgRuntimeDir: "does-not-exist",
defaultSocketPath: "/default/containerd.sock",
},
want: "unix:///default/containerd.sock",
want: "/default/containerd.sock",
wantErr: assert.NoError,
},
{
Expand All @@ -58,7 +58,7 @@ func Test_getContainerHostAddress(t *testing.T) {
xdgRuntimeDir: "/xdg-runtime-empty",
defaultSocketPath: "/default/containerd.sock",
},
want: "unix:///default/containerd.sock",
want: "/default/containerd.sock",
wantErr: assert.NoError,
},
{
Expand All @@ -68,7 +68,7 @@ func Test_getContainerHostAddress(t *testing.T) {
xdgRuntimeDir: "/xdg-runtime-stale",
defaultSocketPath: "/default/containerd.sock",
},
want: "unix:///default/containerd.sock",
want: "/default/containerd.sock",
wantErr: assert.NoError,
},
{
Expand Down

0 comments on commit d09921b

Please sign in to comment.