Skip to content

Commit

Permalink
fix node-identity append test
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodingenthusiast committed Mar 6, 2023
1 parent bf9fb37 commit 22fde76
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions command/acl/token/update/token_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,7 @@ func TestTokenUpdateCommand(t *testing.T) {

// create a token
token, _, err := client.ACL().TokenCreate(
&api.ACLToken{Description: "test",
NodeIdentities: []*api.ACLNodeIdentity{
{
NodeName: "first-node",
Datacenter: "middleearth-southwest",
},
},
ServiceIdentities: []*api.ACLServiceIdentity{
{
ServiceName: "fake-service",
},
},
},
&api.ACLToken{Description: "test"},
&api.WriteOptions{Token: "root"},
)
require.NoError(t, err)
Expand Down Expand Up @@ -149,8 +137,6 @@ func TestTokenUpdateCommand(t *testing.T) {

// update with service-identity
t.Run("service-identity", func(t *testing.T) {
require.Len(t, token.ServiceIdentities, 1)

token := run(t, []string{
"-http-addr=" + a.HTTPAddr(),
"-accessor-id=" + token.AccessorID,
Expand Down Expand Up @@ -210,13 +196,8 @@ func TestTokenUpdateCommandWithAppend(t *testing.T) {
Policies: []*api.ACLTokenPolicyLink{{Name: policy.Name}},
NodeIdentities: []*api.ACLNodeIdentity{
{
NodeName: "first-node",
Datacenter: "middleearth-southwest",
},
},
ServiceIdentities: []*api.ACLServiceIdentity{
{
ServiceName: "fake-service",
NodeName: "test-node",
Datacenter: "eastsomewhere",
},
},
},
Expand Down Expand Up @@ -293,22 +274,6 @@ func TestTokenUpdateCommandWithAppend(t *testing.T) {
require.Equal(t, "foo", token.NodeIdentities[1].NodeName)
require.Equal(t, "bar", token.NodeIdentities[1].Datacenter)
})

// update with append-service-identity
t.Run("append-service-identity", func(t *testing.T) {
require.Len(t, token.ServiceIdentities, 1)

token := run(t, []string{
"-http-addr=" + a.HTTPAddr(),
"-accessor-id=" + token.AccessorID,
"-token=root",
"-append-service-identity=service:datapalace",
"-description=test token",
})

require.Len(t, token.ServiceIdentities, 2)
require.Equal(t, "service", token.ServiceIdentities[1].ServiceName)
})
}

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

0 comments on commit 22fde76

Please sign in to comment.