Fixed another list of unstable unit tests in travis (#4915)
* Fixed another list of unstable unit tests in travis Fixed failing tests in https://travis-ci.org/hashicorp/consul/jobs/451357061 * Fixed another list of unstable unit tests in travis. Fixed failing tests in https://travis-ci.org/hashicorp/consul/jobs/451357061
This commit is contained in:
parent
559b2b63e0
commit
d0ca1bade9
|
@ -41,7 +41,7 @@ func TestRPC_NoLeader_Fail(t *testing.T) {
|
|||
}
|
||||
|
||||
// Now make sure it goes through.
|
||||
testrpc.WaitForLeader(t, s1.RPC, "dc1")
|
||||
testrpc.WaitForTestAgent(t, s1.RPC, "dc1")
|
||||
err = msgpackrpc.CallWithCodec(codec, "Catalog.Register", &arg, &out)
|
||||
if err != nil {
|
||||
t.Fatalf("bad: %v", err)
|
||||
|
@ -84,7 +84,7 @@ func TestRPC_NoLeader_Fail_on_stale_read(t *testing.T) {
|
|||
t.Fatalf("expected %v but got err: %v", structs.ErrNoLeader, err)
|
||||
}
|
||||
|
||||
testrpc.WaitForLeader(t, s1.RPC, "dc1")
|
||||
testrpc.WaitForTestAgent(t, s1.RPC, "dc1")
|
||||
if err := msgpackrpc.CallWithCodec(codec, "KVS.ListKeys", &getKeysReq, &keyList); err != nil {
|
||||
t.Fatalf("Did not expect any error but got err: %v", err)
|
||||
}
|
||||
|
|
|
@ -506,6 +506,7 @@ func TestServer_JoinLAN_TLS(t *testing.T) {
|
|||
}
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
testrpc.WaitForTestAgent(t, s1.RPC, "dc1")
|
||||
|
||||
dir2, conf2 := testServerConfig(t)
|
||||
conf2.Bootstrap = false
|
||||
|
@ -521,6 +522,7 @@ func TestServer_JoinLAN_TLS(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
joinLAN(t, s2, s1)
|
||||
testrpc.WaitForTestAgent(t, s2.RPC, "dc1")
|
||||
|
||||
// Verify Raft has established a peer
|
||||
retry.Run(t, func(r *retry.R) {
|
||||
|
|
|
@ -41,7 +41,7 @@ func TestStatusLeader(t *testing.T) {
|
|||
t.Fatalf("unexpected leader: %v", leader)
|
||||
}
|
||||
|
||||
testrpc.WaitForLeader(t, s1.RPC, "dc1")
|
||||
testrpc.WaitForTestAgent(t, s1.RPC, "dc1")
|
||||
|
||||
if err := msgpackrpc.CallWithCodec(codec, "Status.Leader", arg, &leader); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
|
|
@ -1803,7 +1803,7 @@ func TestDNS_NSRecords(t *testing.T) {
|
|||
node_name = "server1"
|
||||
`)
|
||||
defer a.Shutdown()
|
||||
testrpc.WaitForLeader(t, a.RPC, "dc1")
|
||||
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("something.node.consul.", dns.TypeNS)
|
||||
|
@ -1839,7 +1839,7 @@ func TestDNS_NSRecords_IPV6(t *testing.T) {
|
|||
advertise_addr = "::1"
|
||||
`)
|
||||
defer a.Shutdown()
|
||||
testrpc.WaitForLeader(t, a.RPC, "dc1")
|
||||
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("server1.node.dc1.consul.", dns.TypeNS)
|
||||
|
|
|
@ -9,6 +9,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/testrpc"
|
||||
|
||||
"github.com/hashicorp/consul/logger"
|
||||
)
|
||||
|
||||
|
@ -62,6 +64,7 @@ func TestHTTPAPI_MethodNotAllowed_OSS(t *testing.T) {
|
|||
a := NewTestAgent(t.Name(), `acl_datacenter = "dc1"`)
|
||||
a.Agent.LogWriter = logger.NewLogWriter(512)
|
||||
defer a.Shutdown()
|
||||
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||
|
||||
all := []string{"GET", "PUT", "POST", "DELETE", "HEAD", "OPTIONS"}
|
||||
const testTimeout = 10 * time.Second
|
||||
|
@ -123,6 +126,7 @@ func TestHTTPAPI_OptionMethod_OSS(t *testing.T) {
|
|||
a := NewTestAgent(t.Name(), `acl_datacenter = "dc1"`)
|
||||
a.Agent.LogWriter = logger.NewLogWriter(512)
|
||||
defer a.Shutdown()
|
||||
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||
|
||||
testOptionMethod := func(path string, methods []string) {
|
||||
t.Run("OPTIONS "+path, func(t *testing.T) {
|
||||
|
|
|
@ -3,12 +3,15 @@ package agent
|
|||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/consul/testrpc"
|
||||
)
|
||||
|
||||
func TestStatusLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
a := NewTestAgent(t.Name(), "")
|
||||
defer a.Shutdown()
|
||||
testrpc.WaitForLeader(t, a.RPC, "dc1")
|
||||
|
||||
req, _ := http.NewRequest("GET", "/v1/status/leader", nil)
|
||||
obj, err := a.srv.StatusLeader(nil, req)
|
||||
|
|
Loading…
Reference in New Issue