From 130c0746c13c3e7de96e14b9a2dd0717f7659941 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 12 Jul 2019 14:22:11 +0200 Subject: [PATCH] Cleanup "address" when connecting over a UNIX socket When connecting with the daemon using a UNIX socket, the HTTP hostname was set, based on the socket location, which was generating some noise in the test-logs. Given that the actual hostname is not important (the URL just has to be well-formed), the hostname/address can be cleaned up to reduce the noise. This patch strips the path from the `addr`, and keeps `.sock` as address. Before: daemon.go:329: [d15d31ba75501] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd15d31ba75501.sock/_ping: dial unix /tmp/docker-integration/d15d31ba75501.sock: connect: no such file or directory After: daemon.go:329: [d15d31ba75501] error pinging daemon on start: Get http://d15d31ba75501.sock/_ping: dial unix /tmp/docker-integration/d15d31ba75501.sock: connect: no such file or directory Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 92e6e7dd5f7cb71345e9f39e207cda7867c4a90e) Signed-off-by: Sebastiaan van Stijn --- internal/test/daemon/daemon.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/test/daemon/daemon.go b/internal/test/daemon/daemon.go index c20f88a9dc..009ce9e147 100644 --- a/internal/test/daemon/daemon.go +++ b/internal/test/daemon/daemon.go @@ -633,7 +633,9 @@ func (d *Daemon) getClientConfig() (*clientConfig, error) { return nil, err } transport.DisableKeepAlives = true - + if proto == "unix" { + addr = filepath.Base(addr) + } return &clientConfig{ transport: transport, scheme: scheme,