From 7ba804353c90e75c544e89f5faec7567384a037f Mon Sep 17 00:00:00 2001 From: Issac Trotts Date: Mon, 29 Aug 2016 17:55:44 -0700 Subject: [PATCH 1/2] Use naoina/toml instead of BurntSushi/toml --- caddyhttp/markdown/metadata/metadata_toml.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caddyhttp/markdown/metadata/metadata_toml.go b/caddyhttp/markdown/metadata/metadata_toml.go index ec7388a4..8f8800b2 100644 --- a/caddyhttp/markdown/metadata/metadata_toml.go +++ b/caddyhttp/markdown/metadata/metadata_toml.go @@ -3,7 +3,7 @@ package metadata import ( "bytes" - "github.com/BurntSushi/toml" + "github.com/naoina/toml" ) // TOMLParser is the Parser for TOML From 19910833229545c0c799c03719bae6b1f7844b22 Mon Sep 17 00:00:00 2001 From: Issac Trotts Date: Mon, 29 Aug 2016 18:09:46 -0700 Subject: [PATCH 2/2] Fix tests to not make long unix domain socketpaths Some tests were running into this issue: https://github.com/golang/go/issues/6895 Putting the sockets into temp dirs fixes the problem. --- caddyhttp/proxy/proxy_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/caddyhttp/proxy/proxy_test.go b/caddyhttp/proxy/proxy_test.go index a5e6cf4c..c7db7a4b 100644 --- a/caddyhttp/proxy/proxy_test.go +++ b/caddyhttp/proxy/proxy_test.go @@ -200,10 +200,11 @@ func TestUnixSocketProxy(t *testing.T) { })) // Get absolute path for unix: socket - socketPath, err := filepath.Abs("./test_socket") + dir, err := ioutil.TempDir("", "caddy_test") if err != nil { - t.Fatalf("Unable to get absolute path: %v", err) + t.Fatalf("Failed to make temp dir to contain unix socket. %v", err) } + socketPath := filepath.Join(dir, "test_socket") // Change httptest.Server listener to listen to unix: socket ln, err := net.Listen("unix", socketPath) @@ -258,10 +259,11 @@ func GetSocketProxy(messageFormat string, prefix string) (*Proxy, *httptest.Serv fmt.Fprintf(w, messageFormat, r.URL.String()) })) - socketPath, err := filepath.Abs("./test_socket") + dir, err := ioutil.TempDir("", "caddy_test") if err != nil { - return nil, nil, fmt.Errorf("Unable to get absolute path: %v", err) + return nil, nil, fmt.Errorf("Failed to make temp dir to contain unix socket. %v", err) } + socketPath := filepath.Join(dir, "test_socket") ln, err := net.Listen("unix", socketPath) if err != nil {