mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
Merge pull request #1079 from ijt/master
Use naoina/toml for MIT license. Make proxy_test work in any directory.
This commit is contained in:
commit
72e4ba8b5b
2 changed files with 7 additions and 5 deletions
|
@ -3,7 +3,7 @@ package metadata
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/naoina/toml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TOMLParser is the Parser for TOML
|
// TOMLParser is the Parser for TOML
|
||||||
|
|
|
@ -200,10 +200,11 @@ func TestUnixSocketProxy(t *testing.T) {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Get absolute path for unix: socket
|
// Get absolute path for unix: socket
|
||||||
socketPath, err := filepath.Abs("./test_socket")
|
dir, err := ioutil.TempDir("", "caddy_test")
|
||||||
if err != nil {
|
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
|
// Change httptest.Server listener to listen to unix: socket
|
||||||
ln, err := net.Listen("unix", socketPath)
|
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())
|
fmt.Fprintf(w, messageFormat, r.URL.String())
|
||||||
}))
|
}))
|
||||||
|
|
||||||
socketPath, err := filepath.Abs("./test_socket")
|
dir, err := ioutil.TempDir("", "caddy_test")
|
||||||
if err != nil {
|
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)
|
ln, err := net.Listen("unix", socketPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue