go fmt changes
This commit is contained in:
parent
95291ec5ed
commit
dbc407cec9
|
@ -8,11 +8,11 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/agent/structs"
|
"github.com/hashicorp/consul/agent/structs"
|
||||||
"github.com/hashicorp/consul/types"
|
|
||||||
"github.com/hashicorp/consul/testutil/retry"
|
"github.com/hashicorp/consul/testutil/retry"
|
||||||
|
"github.com/hashicorp/consul/types"
|
||||||
"github.com/hashicorp/serf/coordinate"
|
"github.com/hashicorp/serf/coordinate"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCatalogRegister_Service_InvalidAddress(t *testing.T) {
|
func TestCatalogRegister_Service_InvalidAddress(t *testing.T) {
|
||||||
|
@ -112,31 +112,31 @@ func TestCatalogNodes(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCatalog_RegisterNoID(t *testing.T) {
|
func TestCatalog_RegisterNoID(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
a := NewTestAgent(t.Name(), "")
|
a := NewTestAgent(t.Name(), "")
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
|
|
||||||
// Register node
|
// Register node
|
||||||
args := &structs.RegisterRequest{
|
args := &structs.RegisterRequest{
|
||||||
Datacenter: "dc1",
|
Datacenter: "dc1",
|
||||||
Node: "foo",
|
Node: "foo",
|
||||||
Address: "127.0.0.1",
|
Address: "127.0.0.1",
|
||||||
}
|
}
|
||||||
|
|
||||||
var out struct{}
|
var out struct{}
|
||||||
require.NoError(t, a.RPC("Catalog.Register", args, &out))
|
require.NoError(t, a.RPC("Catalog.Register", args, &out))
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", "/v1/catalog/node/foo", nil)
|
req, _ := http.NewRequest("GET", "/v1/catalog/node/foo", nil)
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
obj, err := a.srv.CatalogNodeServices(resp, req)
|
obj, err := a.srv.CatalogNodeServices(resp, req)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Verify an index is set
|
// Verify an index is set
|
||||||
assertIndex(t, resp)
|
assertIndex(t, resp)
|
||||||
|
|
||||||
node := obj.(*structs.NodeServices)
|
node := obj.(*structs.NodeServices)
|
||||||
|
|
||||||
require.NotEqual(t, types.NodeID(""), node.Node.ID)
|
require.NotEqual(t, types.NodeID(""), node.Node.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCatalogNodes_MetaFilter(t *testing.T) {
|
func TestCatalogNodes_MetaFilter(t *testing.T) {
|
||||||
|
|
|
@ -38,14 +38,13 @@ func (c *Catalog) Register(args *structs.RegisterRequest, reply *struct{}) error
|
||||||
return fmt.Errorf("Bad node ID: %v", err)
|
return fmt.Errorf("Bad node ID: %v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
id, err := uuid.GenerateUUID()
|
id, err := uuid.GenerateUUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to generate ID: %v", err)
|
return fmt.Errorf("Failed to generate ID: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
args.ID = types.NodeID(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
args.ID = types.NodeID(id)
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch the ACL token, if any.
|
// Fetch the ACL token, if any.
|
||||||
rule, err := c.srv.resolveToken(args.Token)
|
rule, err := c.srv.resolveToken(args.Token)
|
||||||
|
|
|
@ -134,7 +134,7 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) {
|
||||||
shutdownCh: make(chan struct{}),
|
shutdownCh: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
c.rpcLimiter.Store(rate.NewLimiter(config.RPCRate, config.RPCMaxBurst))
|
c.rpcLimiter.Store(rate.NewLimiter(config.RPCRate, config.RPCMaxBurst))
|
||||||
|
|
||||||
if err := c.initEnterprise(); err != nil {
|
if err := c.initEnterprise(); err != nil {
|
||||||
c.Shutdown()
|
c.Shutdown()
|
||||||
|
|
Loading…
Reference in New Issue