mirror of https://github.com/hashicorp/consul
Remove some sleeps from `local_test.go`
parent
0d90e480b6
commit
4179b9dfe4
|
@ -1,6 +1,7 @@
|
||||||
package agent
|
package agent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/consul/testutil"
|
||||||
"github.com/hashicorp/consul/consul/structs"
|
"github.com/hashicorp/consul/consul/structs"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -14,18 +15,16 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
defer agent.Shutdown()
|
defer agent.Shutdown()
|
||||||
|
|
||||||
// Wait for a leader
|
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
|
|
||||||
// Register info
|
|
||||||
args := &structs.RegisterRequest{
|
args := &structs.RegisterRequest{
|
||||||
Datacenter: "dc1",
|
Datacenter: "dc1",
|
||||||
Node: agent.config.NodeName,
|
Node: agent.config.NodeName,
|
||||||
Address: "127.0.0.1",
|
Address: "127.0.0.1",
|
||||||
}
|
}
|
||||||
var out struct{}
|
|
||||||
|
|
||||||
// Exists both, same (noop)
|
testutil.WaitForLeader(t, agent.RPC, args)
|
||||||
|
|
||||||
|
// Register info. Exists both, same (noop)
|
||||||
|
var out struct{}
|
||||||
srv1 := &structs.NodeService{
|
srv1 := &structs.NodeService{
|
||||||
ID: "mysql",
|
ID: "mysql",
|
||||||
Service: "mysql",
|
Service: "mysql",
|
||||||
|
@ -137,18 +136,16 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
defer agent.Shutdown()
|
defer agent.Shutdown()
|
||||||
|
|
||||||
// Wait for a leader
|
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
|
|
||||||
// Register info
|
|
||||||
args := &structs.RegisterRequest{
|
args := &structs.RegisterRequest{
|
||||||
Datacenter: "dc1",
|
Datacenter: "dc1",
|
||||||
Node: agent.config.NodeName,
|
Node: agent.config.NodeName,
|
||||||
Address: "127.0.0.1",
|
Address: "127.0.0.1",
|
||||||
}
|
}
|
||||||
var out struct{}
|
|
||||||
|
|
||||||
// Exists both, same (noop)
|
testutil.WaitForLeader(t, agent.RPC, args)
|
||||||
|
|
||||||
|
// Register info. Exists both, same (noop)
|
||||||
|
var out struct{}
|
||||||
chk1 := &structs.HealthCheck{
|
chk1 := &structs.HealthCheck{
|
||||||
Node: agent.config.NodeName,
|
Node: agent.config.NodeName,
|
||||||
CheckID: "mysql",
|
CheckID: "mysql",
|
||||||
|
|
Loading…
Reference in New Issue