Merge pull request #4259 from hashicorp/feature/failing-ttl-test

[BUGFIX] UI - Make sure lock session TTLs are shown
This commit is contained in:
John Cowen 2018-06-21 20:33:03 +01:00 committed by GitHub
commit 57e7ab7ef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 2 deletions

View File

@ -13,7 +13,7 @@ export default Model.extend({
ModifyIndex: attr('number'),
LockDelay: attr('number'),
Behavior: attr('string'),
TTL: attr('number'),
TTL: attr('string'),
Checks: attr({
defaultValue: function() {
return [];

View File

@ -1,5 +1,6 @@
{{#if (gt sessions.length 0)}}
{{#tabular-collection
data-test-sessions
class="sessions"
items=sessions as |item index|
}}
@ -22,7 +23,7 @@
<td>
{{item.LockDelay}}
</td>
<td>
<td data-test-session-ttl="{{item.TTL}}">
{{item.TTL}}
</td>
<td>

View File

@ -0,0 +1,28 @@
@setupApplicationTest
Feature: dc / nodes / sessions /list: List Lock Sessions
In order to get information regarding lock sessions
As a user
I should be able to see a listing of lock sessions with necessary information under the lock sessions tab for a node
Scenario: Given 2 session with string TTLs
Given 1 datacenter model with the value "dc1"
And 1 node model from yaml
---
- ID: node-0
---
And 2 session models from yaml
---
- TTL: 30s
- TTL: 60m
---
When I visit the node page for yaml
---
dc: dc1
node: node-0
---
And I click lockSessions on the tabs
Then I see lockSessionsIsSelected on the tabs
Then I see TTL on the sessions like yaml
---
- 30s
- 60m
---

View File

@ -0,0 +1,10 @@
import steps from '../../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -17,6 +17,9 @@ export default function(type, count, obj) {
key = 'CONSUL_ACL_COUNT';
obj['CONSUL_ENABLE_ACLS'] = 1;
break;
case 'session':
key = 'CONSUL_SESSION_COUNT';
break;
}
if (key) {
obj[key] = count;

View File

@ -16,6 +16,9 @@ export default function(type) {
case 'acl':
url = ['/v1/acl/list'];
break;
case 'session':
url = ['/v1/session/node/'];
break;
}
return function(actual) {
if (url === null) {

View File

@ -10,4 +10,7 @@ export default create({
services: collection('#services [data-test-tabular-row]', {
port: attribute('data-test-service-port', '.port'),
}),
sessions: collection('#lock-sessions [data-test-tabular-row]', {
TTL: attribute('data-test-session-ttl', '[data-test-session-ttl]'),
}),
});

View File

@ -33,6 +33,9 @@ export default function(assert) {
case 'acls':
model = 'acl';
break;
case 'sessions':
model = 'session';
break;
}
cb(null, model);
}, yadda)
@ -218,6 +221,8 @@ export default function(assert) {
) {
const _component = currentPage[component];
const iterator = new Array(_component.length).fill(true);
// this will catch if we get aren't managing to select a component
assert.ok(iterator.length > 0);
iterator.forEach(function(item, i, arr) {
const actual = _component.objectAt(i)[property];
// anything coming from the DOM is going to be text/strings