diff --git a/command/agent/catalog_endpoint_test.go b/command/agent/catalog_endpoint_test.go index 9ae11c4dbf..c9e094dcb8 100644 --- a/command/agent/catalog_endpoint_test.go +++ b/command/agent/catalog_endpoint_test.go @@ -20,16 +20,14 @@ func TestCatalogRegister(t *testing.T) { testutil.WaitForLeader(t, srv.agent.RPC) // Register node - args := &structs.RegisterRequest{ - Datacenter: "dc1", - Node: "foo", - Address: "127.0.0.1", - } - req, err := http.NewRequest("GET", "/v1/catalog/register", nil) if err != nil { t.Fatalf("err: %v", err) } + args := &structs.RegisterRequest{ + Node: "foo", + Address: "127.0.0.1", + } req.Body = encodeReq(args) obj, err := srv.CatalogRegister(nil, req) @@ -52,15 +50,13 @@ func TestCatalogDeregister(t *testing.T) { testutil.WaitForLeader(t, srv.agent.RPC) // Register node - args := &structs.DeregisterRequest{ - Datacenter: "dc1", - Node: "foo", - } - req, err := http.NewRequest("GET", "/v1/catalog/deregister", nil) if err != nil { t.Fatalf("err: %v", err) } + args := &structs.DeregisterRequest{ + Node: "foo", + } req.Body = encodeReq(args) obj, err := srv.CatalogDeregister(nil, req) diff --git a/consul/catalog_endpoint_test.go b/consul/catalog_endpoint_test.go index 4c5a2c70b4..149651de6b 100644 --- a/consul/catalog_endpoint_test.go +++ b/consul/catalog_endpoint_test.go @@ -257,11 +257,6 @@ func TestCatalogListNodes_StaleRaad(t *testing.T) { testutil.WaitForLeader(t, client1.Call) testutil.WaitForLeader(t, client2.Call) - args := structs.DCSpecificRequest{ - Datacenter: "dc1", - QueryOptions: structs.QueryOptions{AllowStale: true}, - } - // Use the follower as the client var client *rpc.Client if !s1.IsLeader() { @@ -276,6 +271,10 @@ func TestCatalogListNodes_StaleRaad(t *testing.T) { s2.fsm.State().EnsureNode(1, structs.Node{"foo", "127.0.0.1"}) } + args := structs.DCSpecificRequest{ + Datacenter: "dc1", + QueryOptions: structs.QueryOptions{AllowStale: true}, + } var out structs.IndexedNodes if err := client.Call("Catalog.ListNodes", &args, &out); err != nil { t.Fatalf("err: %v", err)