From ad914e16c2200d9140c585850f57eb323c926670 Mon Sep 17 00:00:00 2001 From: Dhia Ayachi Date: Mon, 13 Sep 2021 16:53:09 -0400 Subject: [PATCH] acl-tokens table partitioning (#11020) * convert `Policies` index to use `indexerMulti` * remove non used indexer * fix oss policy Get * add oss tests * remove reference to partition in oss test * convert `Roles` index to use `indexerMulti` * add role test in oss * fix oss to use the right index func * convert `Roles` index to use `indexerSingle` * split authmethod write indexer to oss and ent * add auth method unit tests * add index locality * move intFromBool to be available for oss * add expiry indexes * add api tests * fix rebase * use Bool func * preallocate slice * rename variable --- api/acl_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/api/acl_test.go b/api/acl_test.go index 802675014d..d33f63c505 100644 --- a/api/acl_test.go +++ b/api/acl_test.go @@ -234,12 +234,20 @@ func TestAPI_ACLPolicy_List(t *testing.T) { } func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) { + return prepTokenPoliciesInPartition(t, acl, "") +} + +func prepTokenPoliciesInPartition(t *testing.T, acl *ACL, partition string) (policies []*ACLPolicy) { + var wqPart *WriteOptions + if partition != "" { + wqPart = &WriteOptions{Partition: partition} + } policy, _, err := acl.PolicyCreate(&ACLPolicy{ Name: "one", Description: "one description", Rules: `acl = "read"`, Datacenters: []string{"dc1", "dc2"}, - }, nil) + }, wqPart) require.NoError(t, err) require.NotNil(t, policy) @@ -250,7 +258,7 @@ func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) { Description: "two description", Rules: `node_prefix "" { policy = "read" }`, Datacenters: []string{"dc1", "dc2"}, - }, nil) + }, wqPart) require.NoError(t, err) require.NotNil(t, policy) @@ -260,7 +268,7 @@ func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) { Name: "three", Description: "three description", Rules: `service_prefix "" { policy = "read" }`, - }, nil) + }, wqPart) require.NoError(t, err) require.NotNil(t, policy) @@ -270,7 +278,7 @@ func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) { Name: "four", Description: "four description", Rules: `agent "foo" { policy = "write" }`, - }, nil) + }, wqPart) require.NoError(t, err) require.NotNil(t, policy)