agent: clarified a number of comments per PR feedback

This commit is contained in:
Mitchell Hashimoto 2018-03-12 10:13:44 -07:00
parent 353953fcd2
commit 6313bc5615
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
5 changed files with 10 additions and 5 deletions

View File

@ -1372,6 +1372,9 @@ func TestAgent_RegisterService_ConnectProxy(t *testing.T) {
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
// Register a proxy. Note that the destination doesn't exist here on
// this agent or in the catalog at all. This is intended and part
// of the design.
args := &structs.ServiceDefinition{
Kind: structs.ServiceKindConnectProxy,
Name: "connect-proxy",
@ -1388,7 +1391,7 @@ func TestAgent_RegisterService_ConnectProxy(t *testing.T) {
assert.Nil(err)
assert.Nil(obj)
// Ensure the servie
// Ensure the service
svc, ok := a.State.Services()["connect-proxy"]
assert.True(ok, "has service")
assert.Equal(structs.ServiceKindConnectProxy, svc.Kind)

View File

@ -393,7 +393,6 @@ func TestCatalog_Register_ConnectProxy_ACLProxyDestination(t *testing.T) {
c.ACLDatacenter = "dc1"
c.ACLMasterToken = "root"
c.ACLDefaultPolicy = "deny"
c.ACLEnforceVersion8 = false
})
defer os.RemoveAll(dir1)
defer s1.Shutdown()
@ -1802,7 +1801,6 @@ func TestCatalog_ListServiceNodes_ConnectProxy_ACL(t *testing.T) {
c.ACLDatacenter = "dc1"
c.ACLMasterToken = "root"
c.ACLDefaultPolicy = "deny"
c.ACLEnforceVersion8 = false
})
defer os.RemoveAll(dir1)
defer s1.Shutdown()

View File

@ -1049,7 +1049,7 @@ func TestDNS_ConnectServiceLookup(t *testing.T) {
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
// Register a node with an external service.
// Register
{
args := structs.TestRegisterRequestProxy(t)
args.Service.ProxyDestination = "db"

View File

@ -1,6 +1,7 @@
package structs
// ServiceDefinition is used to JSON decode the Service definitions
// ServiceDefinition is used to JSON decode the Service definitions. For
// documentation on specific fields see NodeService which is better documented.
type ServiceDefinition struct {
Kind ServiceKind
ID string

View File

@ -491,6 +491,9 @@ type NodeService struct {
// ProxyDestination is the name of the service that this service is
// a Connect proxy for. This is only valid if Kind is "connect-proxy".
// The destination may be a service that isn't present in the catalog.
// This is expected and allowed to allow for proxies to come up
// earlier than their target services.
ProxyDestination string
RaftIndex