diff --git a/command/agent/config_test.go b/command/agent/config_test.go index 40c9eca27..2c8571fa8 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -2,6 +2,7 @@ package agent import ( "io/ioutil" + "net" "os" "path/filepath" "reflect" @@ -541,3 +542,14 @@ func TestResources_ParseReserved(t *testing.T) { } } + +func TestIsMissingPort(t *testing.T) { + _, _, err := net.SplitHostPort("localhost") + if missing := isMissingPort(err); !missing { + t.Errorf("expected missing port error, but got %v", err) + } + _, _, err = net.SplitHostPort("localhost:9000") + if missing := isMissingPort(err); missing { + t.Errorf("expected no error, but got %v", err) + } +}