Skip to content

Commit ac14e0d

Browse files
author
Justin Fudally
committed
Fix for tests
1 parent cb962aa commit ac14e0d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

go/config/haproxy_config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ func (h *HostPort) URL() *url.URL {
2828

2929
func ParseHostPort(address string) (hostPort *HostPort, err error) {
3030
if !strings.Contains(address, ":") {
31+
if address == "" {
32+
return &HostPort{address, 80}, fmt.Errorf("Invalid host address: %s", address)
33+
}
34+
3135
return &HostPort{Host: address, Port: 80}, nil
3236
}
3337

go/config/haproxy_config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestParseAddresses(t *testing.T) {
7171
{
7272
c := &HAProxyConfigurationSettings{Addresses: "localhost"}
7373
_, err := c.parseAddresses()
74-
test.S(t).ExpectNotNil(err)
74+
test.S(t).ExpectNil(err)
7575
}
7676
{
7777
c := &HAProxyConfigurationSettings{Addresses: "localhost:"}

0 commit comments

Comments
 (0)