summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/caddyhttp_test.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-05-14 14:14:05 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-05-14 14:14:05 -0600
commitf9d93ead4ef6e099ba7e00318dce6509b0f1eda4 (patch)
treeb14b418475d25c1aa4d13cb53b5e162054570483 /modules/caddyhttp/caddyhttp_test.go
parent8ae0d6a509fd1b871457cf742369af04346933a8 (diff)
Rename and export some types, other minor changes
Diffstat (limited to 'modules/caddyhttp/caddyhttp_test.go')
-rw-r--r--modules/caddyhttp/caddyhttp_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/caddyhttp/caddyhttp_test.go b/modules/caddyhttp/caddyhttp_test.go
index 8d25332..dee3977 100644
--- a/modules/caddyhttp/caddyhttp_test.go
+++ b/modules/caddyhttp/caddyhttp_test.go
@@ -1,6 +1,7 @@
package caddyhttp
import (
+ "os"
"reflect"
"testing"
)
@@ -114,6 +115,11 @@ func TestJoinListenerAddr(t *testing.T) {
}
func TestParseListenerAddr(t *testing.T) {
+ hostname, err := os.Hostname()
+ if err != nil {
+ t.Fatalf("Cannot ascertain system hostname: %v", err)
+ }
+
for i, tc := range []struct {
input string
expectNetwork string
@@ -170,6 +176,11 @@ func TestParseListenerAddr(t *testing.T) {
expectNetwork: "tcp",
expectAddrs: []string{"localhost:0"},
},
+ {
+ input: "{system.hostname}:0",
+ expectNetwork: "tcp",
+ expectAddrs: []string{hostname + ":0"},
+ },
} {
actualNetwork, actualAddrs, err := parseListenAddr(tc.input)
if tc.expectErr && err == nil {