Hedge for when consul sends nodes with an empty ID

This commit is contained in:
John Cowen 2018-07-03 13:23:45 +01:00
parent aa067c049a
commit a47a0b617f
3 changed files with 46 additions and 0 deletions

View File

@ -23,6 +23,9 @@ export default Adapter.extend({
break; break;
default: default:
response = response.map((item, i, arr) => { response = response.map((item, i, arr) => {
if (item[SLUG_KEY] === '') {
item[SLUG_KEY] = item['Node'];
}
return { return {
...item, ...item,
...{ ...{

View File

@ -0,0 +1,33 @@
@setupApplicationTest
Feature: Hedge for if nodes come in over the API with no ID
Scenario: A node list with some missing IDs
Given 1 datacenter model with the value "dc-1"
And 5 node models from yaml
---
- ID: id-1
Node: name-1
- ID: ""
Node: name-2
- ID: ""
Node: name-3
- ID: ""
Node: name-4
- ID: ""
Node: name-5
---
When I visit the nodes page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/nodes
Then I see name on the nodes like yaml
---
- name-1
- name-2
- name-3
- name-4
- name-5
@ignore
Scenario: Visually comparing
Then the ".unhealthy" element should look like the "/node_modules/@hashicorp/consul-testing-extras/fixtures/dc/nodes/empty-ids.png" image

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);
});
}