Commit 77ec3d1f authored by AndrewChubatiuk's avatar AndrewChubatiuk
Browse files

pr comments

parent 66e3e95a
Showing with 6 additions and 5 deletions
+6 -5
......@@ -2,9 +2,10 @@ package consul
import (
"fmt"
"net"
"strconv"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/ipaddr"
"github.com/hashicorp/nomad/helper"
"github.com/hashicorp/nomad/nomad/structs"
)
......@@ -112,7 +113,7 @@ func connectSidecarRegistration(serviceId string, css *structs.ConsulSidecarServ
Checks: api.AgentServiceChecks{
{
Name: "Connect Sidecar Listening",
TCP: ipaddr.FormatAddressPort(cMapping.HostIP, cMapping.Value),
TCP: net.JoinHostPort(cMapping.HostIP, strconv.Itoa(cMapping.Value)),
Interval: "10s",
},
{
......@@ -225,7 +226,7 @@ func connectPort(portLabel string, networks structs.Networks, ports structs.Allo
if mapping.Value > 0 {
return mapping, nil
}
return structs.AllocatedPortMapping{}, fmt.Errorf("invalid port %q: port label not found", portLabel)
return structs.AllocatedPortMapping{}, fmt.Errorf("No port of label %q defined", portLabel)
}
return mapping, nil
}
......
......@@ -94,7 +94,7 @@ func TestConnect_connectSidecarRegistration(t *testing.T) {
_, err := connectSidecarRegistration("unknown-id", &structs.ConsulSidecarService{
Port: "unknown-label",
}, testConnectNetwork, testConnectPorts)
require.EqualError(t, err, `invalid port "unknown-label": port label not found`)
require.EqualError(t, err, `No port of label "unknown-label" defined`)
})
t.Run("bad proxy", func(t *testing.T) {
......@@ -383,7 +383,7 @@ func TestConnect_getConnectPort(t *testing.T) {
t.Run("no such service", func(t *testing.T) {
_, err := connectPort("other", networks, ports)
require.EqualError(t, err, `invalid port "other": port label not found`)
require.EqualError(t, err, `No port of label "other" defined`)
})
t.Run("no network", func(t *testing.T) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment