mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
pr comments
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user