summaryrefslogtreecommitdiff
path: root/listeners_test.go
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2019-09-09 21:46:21 -0600
committerGitHub <noreply@github.com>2019-09-09 21:46:21 -0600
commit44b7ce98505ab8a34f6c632e661dd2cfae475a17 (patch)
tree4cd125e485047419fd19098007280b013906a0bc /listeners_test.go
parent9169cd43d49236c69d5c9b7c556cb0ac0c9ce497 (diff)
parentb4f4fcd437c2f9816f9511217bde703679808679 (diff)
Merge pull request #2737 from caddyserver/fastcgi (reverse proxy!)
v2: Refactor reverse proxy and add FastCGI support
Diffstat (limited to 'listeners_test.go')
-rw-r--r--listeners_test.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/listeners_test.go b/listeners_test.go
index 7c5a2fc..11d3980 100644
--- a/listeners_test.go
+++ b/listeners_test.go
@@ -19,7 +19,7 @@ import (
"testing"
)
-func TestSplitListenerAddr(t *testing.T) {
+func TestSplitNetworkAddress(t *testing.T) {
for i, tc := range []struct {
input string
expectNetwork string
@@ -67,8 +67,18 @@ func TestSplitListenerAddr(t *testing.T) {
expectNetwork: "unix",
expectHost: "/foo/bar",
},
+ {
+ input: "unixgram//foo/bar",
+ expectNetwork: "unixgram",
+ expectHost: "/foo/bar",
+ },
+ {
+ input: "unixpacket//foo/bar",
+ expectNetwork: "unixpacket",
+ expectHost: "/foo/bar",
+ },
} {
- actualNetwork, actualHost, actualPort, err := SplitListenAddr(tc.input)
+ actualNetwork, actualHost, actualPort, err := SplitNetworkAddress(tc.input)
if tc.expectErr && err == nil {
t.Errorf("Test %d: Expected error but got: %v", i, err)
}
@@ -87,7 +97,7 @@ func TestSplitListenerAddr(t *testing.T) {
}
}
-func TestJoinListenerAddr(t *testing.T) {
+func TestJoinNetworkAddress(t *testing.T) {
for i, tc := range []struct {
network, host, port string
expect string
@@ -129,14 +139,14 @@ func TestJoinListenerAddr(t *testing.T) {
expect: "unix//foo/bar",
},
} {
- actual := JoinListenAddr(tc.network, tc.host, tc.port)
+ actual := JoinNetworkAddress(tc.network, tc.host, tc.port)
if actual != tc.expect {
t.Errorf("Test %d: Expected '%s' but got '%s'", i, tc.expect, actual)
}
}
}
-func TestParseListenerAddr(t *testing.T) {
+func TestParseNetworkAddress(t *testing.T) {
for i, tc := range []struct {
input string
expectNetwork string
@@ -194,7 +204,7 @@ func TestParseListenerAddr(t *testing.T) {
expectAddrs: []string{"localhost:0"},
},
} {
- actualNetwork, actualAddrs, err := ParseListenAddr(tc.input)
+ actualNetwork, actualAddrs, err := ParseNetworkAddress(tc.input)
if tc.expectErr && err == nil {
t.Errorf("Test %d: Expected error but got: %v", i, err)
}