test: Tweaks ACL replication tests to converge faster w/less spam.
This commit is contained in:
parent
b9fb20d0cf
commit
ffdfe2c201
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/hashicorp/consul/consul/structs"
|
||||
"github.com/hashicorp/consul/lib"
|
||||
"github.com/hashicorp/consul/testrpc"
|
||||
"github.com/hashicorp/consul/testutil/retry"
|
||||
"github.com/hashicorp/net-rpc-msgpackrpc"
|
||||
)
|
||||
|
||||
|
@ -471,7 +472,7 @@ func TestACLEndpoint_ReplicationStatus(t *testing.T) {
|
|||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc2"
|
||||
c.ACLReplicationToken = "secret"
|
||||
c.ACLReplicationInterval = 0
|
||||
c.ACLReplicationInterval = 10 * time.Millisecond
|
||||
})
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -483,12 +484,15 @@ func TestACLEndpoint_ReplicationStatus(t *testing.T) {
|
|||
getR := structs.DCSpecificRequest{
|
||||
Datacenter: "dc1",
|
||||
}
|
||||
var status structs.ACLReplicationStatus
|
||||
err := msgpackrpc.CallWithCodec(codec, "ACL.ReplicationStatus", &getR, &status)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !status.Enabled || !status.Running || status.SourceDatacenter != "dc2" {
|
||||
t.Fatalf("bad: %#v", status)
|
||||
}
|
||||
|
||||
retry.Run("", t, func(r *retry.R) {
|
||||
var status structs.ACLReplicationStatus
|
||||
err := msgpackrpc.CallWithCodec(codec, "ACL.ReplicationStatus", &getR, &status)
|
||||
if err != nil {
|
||||
r.Fatalf("err: %v", err)
|
||||
}
|
||||
if !status.Enabled || !status.Running || status.SourceDatacenter != "dc2" {
|
||||
r.Fatalf("bad: %#v", status)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ func TestACLReplication(t *testing.T) {
|
|||
c.Datacenter = "dc2"
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLReplicationToken = "root"
|
||||
c.ACLReplicationInterval = 0
|
||||
c.ACLReplicationInterval = 10 * time.Millisecond
|
||||
c.ACLReplicationApplyLimit = 1000000
|
||||
})
|
||||
defer os.RemoveAll(dir2)
|
||||
|
@ -348,7 +348,7 @@ func TestACLReplication(t *testing.T) {
|
|||
|
||||
// Create a bunch of new tokens.
|
||||
var id string
|
||||
for i := 0; i < 1000; i++ {
|
||||
for i := 0; i < 50; i++ {
|
||||
arg := structs.ACLRequest{
|
||||
Datacenter: "dc1",
|
||||
Op: structs.ACLSet,
|
||||
|
@ -402,7 +402,7 @@ func TestACLReplication(t *testing.T) {
|
|||
})
|
||||
|
||||
// Create more new tokens.
|
||||
for i := 0; i < 1000; i++ {
|
||||
for i := 0; i < 50; i++ {
|
||||
arg := structs.ACLRequest{
|
||||
Datacenter: "dc1",
|
||||
Op: structs.ACLSet,
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/acl"
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
|
@ -632,7 +633,7 @@ func TestACL_Replication(t *testing.T) {
|
|||
c.ACLDefaultPolicy = "deny"
|
||||
c.ACLDownPolicy = "extend-cache"
|
||||
c.ACLReplicationToken = "root"
|
||||
c.ACLReplicationInterval = 0
|
||||
c.ACLReplicationInterval = 10 * time.Millisecond
|
||||
c.ACLReplicationApplyLimit = 1000000
|
||||
})
|
||||
defer os.RemoveAll(dir2)
|
||||
|
@ -643,7 +644,7 @@ func TestACL_Replication(t *testing.T) {
|
|||
c.ACLDatacenter = "dc1"
|
||||
c.ACLDownPolicy = "deny"
|
||||
c.ACLReplicationToken = "root"
|
||||
c.ACLReplicationInterval = 0
|
||||
c.ACLReplicationInterval = 10 * time.Millisecond
|
||||
c.ACLReplicationApplyLimit = 1000000
|
||||
})
|
||||
defer os.RemoveAll(dir3)
|
||||
|
|
Loading…
Reference in New Issue