diff --git a/agent/agent_test.go b/agent/agent_test.go index ef0be73b84..7a648178dd 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -652,9 +652,8 @@ func test_createAlias(t *testing.T, agent *TestAgent, chk *structs.CheckType, ex if c.Check.CheckID == chk.CheckID { found = true assert.Equal(t, expectedResult, c.Check.Status, "Check state should be %s, was %s in %#v", expectedResult, c.Check.Status, c.Check) - var srvID structs.ServiceID - srvID.Init(srv.ID, structs.WildcardEnterpriseMeta()) - if err := agent.Agent.State.RemoveService(structs.ServiceID(srvID)); err != nil { + srvID := structs.NewServiceID(srv.ID, structs.WildcardEnterpriseMeta()) + if err := agent.Agent.State.RemoveService(srvID); err != nil { fmt.Println("[DEBUG] Fail to remove service", srvID, ", err:=", err) } fmt.Println("[DEBUG] Service Removed", srvID, ", err:=", err) @@ -715,8 +714,7 @@ func TestAgent_CheckAliasRPC(t *testing.T) { err := a.RPC("Catalog.NodeServices", &args, &out) assert.NoError(r, err) foundService := false - var lookup structs.ServiceID - lookup.Init("svcid1", structs.WildcardEnterpriseMeta()) + lookup := structs.NewServiceID("svcid1", structs.WildcardEnterpriseMeta()) for _, srv := range out.NodeServices.Services { sid := srv.CompoundServiceID() if lookup.Matches(&sid) { diff --git a/agent/checks/alias.go b/agent/checks/alias.go index 0ef7c0c479..3a0ed36eca 100644 --- a/agent/checks/alias.go +++ b/agent/checks/alias.go @@ -144,7 +144,7 @@ func (c *CheckAlias) checkServiceExistsOnRemoteServer(serviceID *structs.Service args.AllowStale = true args.EnterpriseMeta = c.EnterpriseMeta // We are late at maximum of 15s compared to leader - args.MaxStaleDuration = time.Duration(15 * time.Second) + args.MaxStaleDuration = 15 * time.Second attempts := 0 RETRY_CALL: var out structs.IndexedNodeServices @@ -172,7 +172,7 @@ func (c *CheckAlias) runQuery(stopCh chan struct{}) { args.MaxQueryTime = 1 * time.Minute args.EnterpriseMeta = c.EnterpriseMeta // We are late at maximum of 15s compared to leader - args.MaxStaleDuration = time.Duration(15 * time.Second) + args.MaxStaleDuration = 15 * time.Second var attempt uint for {