Browse Source

Remove all sleeps from `kvs_endpoint_test.go`

pull/136/head
William Tisäter 11 years ago
parent
commit
0d90e480b6
  1. 30
      command/agent/kvs_endpoint_test.go

30
command/agent/kvs_endpoint_test.go

@ -3,13 +3,13 @@ package agent
import (
"bytes"
"fmt"
"github.com/hashicorp/consul/testutil"
"github.com/hashicorp/consul/consul/structs"
"net/http"
"net/http/httptest"
"os"
"reflect"
"testing"
"time"
)
func TestKVSEndpoint_PUT_GET_DELETE(t *testing.T) {
@ -18,8 +18,11 @@ func TestKVSEndpoint_PUT_GET_DELETE(t *testing.T) {
defer srv.Shutdown()
defer srv.agent.Shutdown()
// Wait for a leader
time.Sleep(100 * time.Millisecond)
args := &structs.RegisterRequest{
Datacenter: "dc1",
}
testutil.WaitForLeader(t, srv.agent.RPC, args)
keys := []string{
"baz",
@ -94,8 +97,11 @@ func TestKVSEndpoint_Recurse(t *testing.T) {
defer srv.Shutdown()
defer srv.agent.Shutdown()
// Wait for a leader
time.Sleep(100 * time.Millisecond)
args := &structs.RegisterRequest{
Datacenter: "dc1",
}
testutil.WaitForLeader(t, srv.agent.RPC, args)
keys := []string{
"bar",
@ -191,8 +197,11 @@ func TestKVSEndpoint_CAS(t *testing.T) {
defer srv.Shutdown()
defer srv.agent.Shutdown()
// Wait for a leader
time.Sleep(100 * time.Millisecond)
args := &structs.RegisterRequest{
Datacenter: "dc1",
}
testutil.WaitForLeader(t, srv.agent.RPC, args)
{
buf := bytes.NewBuffer([]byte("test"))
@ -289,8 +298,11 @@ func TestKVSEndpoint_ListKeys(t *testing.T) {
defer srv.Shutdown()
defer srv.agent.Shutdown()
// Wait for a leader
time.Sleep(100 * time.Millisecond)
args := &structs.RegisterRequest{
Datacenter: "dc1",
}
testutil.WaitForLeader(t, srv.agent.RPC, args)
keys := []string{
"bar",

Loading…
Cancel
Save