Add a failing test to show that lock session TTL's are not shown

This commit is contained in:
John Cowen 2018-06-19 15:25:56 +01:00
parent 3c63d3dbb0
commit 6d55c7a98c
7 changed files with 56 additions and 1 deletions

View File

@ -1,5 +1,6 @@
{{#if (gt sessions.length 0)}} {{#if (gt sessions.length 0)}}
{{#tabular-collection {{#tabular-collection
data-test-sessions
class="sessions" class="sessions"
items=sessions as |item index| items=sessions as |item index|
}} }}
@ -22,7 +23,7 @@
<td> <td>
{{item.LockDelay}} {{item.LockDelay}}
</td> </td>
<td> <td data-test-session-ttl="{{item.TTL}}">
{{item.TTL}} {{item.TTL}}
</td> </td>
<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'; key = 'CONSUL_ACL_COUNT';
obj['CONSUL_ENABLE_ACLS'] = 1; obj['CONSUL_ENABLE_ACLS'] = 1;
break; break;
case 'session':
key = 'CONSUL_SESSION_COUNT';
break;
} }
if (key) { if (key) {
obj[key] = count; obj[key] = count;

View File

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

View File

@ -10,4 +10,7 @@ export default create({
services: collection('#services [data-test-tabular-row]', { services: collection('#services [data-test-tabular-row]', {
port: attribute('data-test-service-port', '.port'), 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': case 'acls':
model = 'acl'; model = 'acl';
break; break;
case 'sessions':
model = 'session';
break;
} }
cb(null, model); cb(null, model);
}, yadda) }, yadda)
@ -218,6 +221,8 @@ export default function(assert) {
) { ) {
const _component = currentPage[component]; const _component = currentPage[component];
const iterator = new Array(_component.length).fill(true); 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) { iterator.forEach(function(item, i, arr) {
const actual = _component.objectAt(i)[property]; const actual = _component.objectAt(i)[property];
// anything coming from the DOM is going to be text/strings // anything coming from the DOM is going to be text/strings