Remove some sleeps from `local_test.go`

This commit is contained in:
William Tisäter 2014-05-07 23:27:32 +02:00
parent 89ead7bc4e
commit 795fab8a61
1 changed files with 9 additions and 12 deletions

View File

@ -1,6 +1,7 @@
package agent
import (
"github.com/hashicorp/consul/testutil"
"github.com/hashicorp/consul/consul/structs"
"os"
"reflect"
@ -14,18 +15,16 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
defer os.RemoveAll(dir)
defer agent.Shutdown()
// Wait for a leader
time.Sleep(100 * time.Millisecond)
// Register info
args := &structs.RegisterRequest{
Datacenter: "dc1",
Node: agent.config.NodeName,
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{
ID: "mysql",
Service: "mysql",
@ -137,18 +136,16 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
defer os.RemoveAll(dir)
defer agent.Shutdown()
// Wait for a leader
time.Sleep(100 * time.Millisecond)
// Register info
args := &structs.RegisterRequest{
Datacenter: "dc1",
Node: agent.config.NodeName,
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{
Node: agent.config.NodeName,
CheckID: "mysql",