Skip to content

Commit

Permalink
fix incorrect body of TestACLEndpoint_PolicyBatchRead
Browse files Browse the repository at this point in the history
Lifted from PR #5307 as it was an unrelated drive-by fix on that PR anyway.

s/token/policy/
  • Loading branch information
rboyer committed Feb 22, 2019
1 parent 360e3ac commit c2a30c5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions agent/consul/acl_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1150,32 +1150,32 @@ func TestACLEndpoint_PolicyBatchRead(t *testing.T) {

testrpc.WaitForLeader(t, s1.RPC, "dc1")

t1, err := upsertTestToken(codec, "root", "dc1")
p1, err := upsertTestPolicy(codec, "root", "dc1")
require.NoError(t, err)

t2, err := upsertTestToken(codec, "root", "dc1")
p2, err := upsertTestPolicy(codec, "root", "dc1")
require.NoError(t, err)

acl := ACL{srv: s1}
tokens := []string{t1.AccessorID, t2.AccessorID}
policies := []string{p1.ID, p2.ID}

req := structs.ACLTokenBatchGetRequest{
req := structs.ACLPolicyBatchGetRequest{
Datacenter: "dc1",
AccessorIDs: tokens,
PolicyIDs: policies,
QueryOptions: structs.QueryOptions{Token: "root"},
}

resp := structs.ACLTokenBatchResponse{}
resp := structs.ACLPolicyBatchResponse{}

err = acl.TokenBatchRead(&req, &resp)
err = acl.PolicyBatchRead(&req, &resp)
require.NoError(t, err)

var retrievedTokens []string
var retrievedPolicies []string

for _, v := range resp.Tokens {
retrievedTokens = append(retrievedTokens, v.AccessorID)
for _, v := range resp.Policies {
retrievedPolicies = append(retrievedPolicies, v.ID)
}
require.EqualValues(t, retrievedTokens, tokens)
require.EqualValues(t, retrievedPolicies, policies)
}

func TestACLEndpoint_PolicySet(t *testing.T) {
Expand Down

0 comments on commit c2a30c5

Please sign in to comment.