mirror of https://github.com/status-im/consul.git
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
This commit is contained in:
parent
b4d5860197
commit
ad914e16c2
|
@ -234,12 +234,20 @@ func TestAPI_ACLPolicy_List(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) {
|
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{
|
policy, _, err := acl.PolicyCreate(&ACLPolicy{
|
||||||
Name: "one",
|
Name: "one",
|
||||||
Description: "one description",
|
Description: "one description",
|
||||||
Rules: `acl = "read"`,
|
Rules: `acl = "read"`,
|
||||||
Datacenters: []string{"dc1", "dc2"},
|
Datacenters: []string{"dc1", "dc2"},
|
||||||
}, nil)
|
}, wqPart)
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, policy)
|
require.NotNil(t, policy)
|
||||||
|
@ -250,7 +258,7 @@ func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) {
|
||||||
Description: "two description",
|
Description: "two description",
|
||||||
Rules: `node_prefix "" { policy = "read" }`,
|
Rules: `node_prefix "" { policy = "read" }`,
|
||||||
Datacenters: []string{"dc1", "dc2"},
|
Datacenters: []string{"dc1", "dc2"},
|
||||||
}, nil)
|
}, wqPart)
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, policy)
|
require.NotNil(t, policy)
|
||||||
|
@ -260,7 +268,7 @@ func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) {
|
||||||
Name: "three",
|
Name: "three",
|
||||||
Description: "three description",
|
Description: "three description",
|
||||||
Rules: `service_prefix "" { policy = "read" }`,
|
Rules: `service_prefix "" { policy = "read" }`,
|
||||||
}, nil)
|
}, wqPart)
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, policy)
|
require.NotNil(t, policy)
|
||||||
|
@ -270,7 +278,7 @@ func prepTokenPolicies(t *testing.T, acl *ACL) (policies []*ACLPolicy) {
|
||||||
Name: "four",
|
Name: "four",
|
||||||
Description: "four description",
|
Description: "four description",
|
||||||
Rules: `agent "foo" { policy = "write" }`,
|
Rules: `agent "foo" { policy = "write" }`,
|
||||||
}, nil)
|
}, wqPart)
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, policy)
|
require.NotNil(t, policy)
|
||||||
|
|
Loading…
Reference in New Issue