From 88c2af2f8dbcecebe5c53a81ec865ff7e8e42715 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 13 Feb 2020 17:10:01 -0800 Subject: [PATCH] Add assertion for the volume k/v pairs in task rows --- ui/tests/acceptance/allocation-detail-test.js | 17 +++++++++++++++++ ui/tests/pages/allocations/detail.js | 1 + 2 files changed, 18 insertions(+) diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index 14900bfc1..25e017d59 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -91,6 +91,17 @@ module('Acceptance | allocation detail', function(hooks) { const events = server.db.taskEvents.where({ taskStateId: task.id }); const event = events[events.length - 1]; + const taskGroup = server.schema.taskGroups.where({ + jobId: allocation.jobId, + name: allocation.taskGroup, + }).models[0]; + + const jobTask = taskGroup.tasks.models.find(m => m.name === task.name); + const volumes = jobTask.volumeMounts.map(volume => ({ + name: volume.Volume, + source: taskGroup.volumes[volume.Volume].Source, + })); + Allocation.tasks[0].as(taskRow => { assert.equal(taskRow.name, task.name, 'Name'); assert.equal(taskRow.state, task.state, 'State'); @@ -113,6 +124,12 @@ module('Acceptance | allocation detail', function(hooks) { assert.ok(addressesText.includes(port.Label), `Found label ${port.Label}`); assert.ok(addressesText.includes(port.Value), `Found value ${port.Value}`); }); + + const volumesText = taskRow.volumes; + volumes.forEach(volume => { + assert.ok(volumesText.includes(volume.name), `Found label ${volume.name}`); + assert.ok(volumesText.includes(volume.source), `Found value ${volume.source}`); + }); }); }); diff --git a/ui/tests/pages/allocations/detail.js b/ui/tests/pages/allocations/detail.js index 7fd1a311e..f0ddf45f5 100644 --- a/ui/tests/pages/allocations/detail.js +++ b/ui/tests/pages/allocations/detail.js @@ -42,6 +42,7 @@ export default create({ message: text('[data-test-message]'), time: text('[data-test-time]'), ports: text('[data-test-ports]'), + volumes: text('[data-test-volumes]'), hasUnhealthyDriver: isPresent('[data-test-icon="unhealthy-driver"]'), hasProxyTag: isPresent('[data-test-proxy-tag]'),