open-consul/ui-v2/tests/acceptance/dc/acls/tokens/legacy/update.feature
John Cowen d1b3a63b2f
UI: Catch 500 error on token endpoint and revert to legacy tokens (#4874)
In some circumstances a consul 1.4 client could be running in an
un-upgraded 1.3 or lower cluster. Currently this gives a 500 error on
the new ACL token endpoint. Here we catch this specific 500 error/message
and set the users AccessorID to null. Elsewhere in the frontend we use
this fact (AccessorID being null) to decide whether to present the
legacy or the new ACL UI to the user.

Also:
- Re-adds in most of the old style ACL acceptance tests, now that we are keeping the old style UI
- Restricts code editors to HCL only mode for all `Rules` editing (legacy/'half legacy'/new style)
- Adds a [Stop using] button to the old style ACL rows so its possible to logout.
- Updates copy and documentation links for the upgrade notices
2018-11-02 14:44:36 +00:00

57 lines
1.8 KiB
Gherkin

@setupApplicationTest
Feature: dc / acls / tokens / legacy / update: ACL Token Update
Background:
Given 1 datacenter model with the value "datacenter"
And 1 token model from yaml
---
AccessorID: key
SecretID: secret
Rules: 'key {}'
Type: client
Policies: ~
---
When I visit the token page for yaml
---
dc: datacenter
token: key
---
Then the url should be /datacenter/acls/tokens/key
Scenario: Update to [Name]
Then I fill in with yaml
---
name: [Name]
---
# TODO: Remove this when I'm 100% sure token types are gone
# And I click "[value=[Type]]"
And I submit
Then a PUT request is made to "/v1/acl/update?dc=datacenter" with the body from yaml
# You can no longer edit Type but make sure it gets sent
---
ID: secret
Name: [Name]
Type: client
---
Then the url should be /datacenter/acls/tokens
And "[data-notification]" has the "notification-update" class
And "[data-notification]" has the "success" class
Where:
---------------------------------------------
| Name | Rules |
| key-name | node "0" {policy = "read"} |
| key name | node "0" {policy = "write"} |
| key%20name | node "0" {policy = "read"} |
| utf8? | node "0" {policy = "write"} |
---------------------------------------------
Scenario: There was an error saving the key
Given the url "/v1/acl/update" responds with a 500 status
And I submit
Then the url should be /datacenter/acls/tokens/key
Then "[data-notification]" has the "notification-update" class
And "[data-notification]" has the "error" class
# @ignore
# Scenario: Rules can be edited/updated
# Then ok
# @ignore
# Scenario: The feedback dialog says success or failure
# Then ok