Test coverage for the volume table on the task group page

This commit is contained in:
Michael Lange 2020-02-13 16:44:41 -08:00
parent 44a961f4f8
commit 41fad6b649
2 changed files with 32 additions and 0 deletions

View File

@ -226,6 +226,30 @@ module('Acceptance | task group detail', function(hooks) {
assert.notOk(normalRow.rescheduled, 'Normal row has no reschedule icon'); assert.notOk(normalRow.rescheduled, 'Normal row has no reschedule icon');
}); });
test('when the task group depends on volumes, the volumes table is shown', async function(assert) {
assert.ok(TaskGroup.hasVolumes);
assert.equal(TaskGroup.volumes.length, Object.keys(taskGroup.volumes).length);
});
test('when the task group does not depend on volumes, the volumes table is not shown', async function(assert) {
job = server.create('job', { noHostVolumes: true, shallow: true });
taskGroup = server.db.taskGroups.where({ jobId: job.id })[0];
await TaskGroup.visit({ id: job.id, name: taskGroup.name });
assert.notOk(TaskGroup.hasVolumes);
});
test('each row in the volumes table lists information about the volume', async function(assert) {
TaskGroup.volumes[0].as(volumeRow => {
const volume = taskGroup.volumes[volumeRow.name];
assert.equal(volumeRow.name, volume.Name);
assert.equal(volumeRow.type, volume.Type);
assert.equal(volumeRow.source, volume.Source);
assert.equal(volumeRow.permissions, volume.ReadOnly ? 'Read' : 'Read/Write');
});
});
test('when the job for the task group is not found, an error message is shown, but the URL persists', async function(assert) { test('when the job for the task group is not found, an error message is shown, but the URL persists', async function(assert) {
await TaskGroup.visit({ id: 'not-a-real-job', name: 'not-a-real-task-group' }); await TaskGroup.visit({ id: 'not-a-real-job', name: 'not-a-real-task-group' });

View File

@ -38,6 +38,14 @@ export default create({
isEmpty: isPresent('[data-test-empty-allocations-list]'), isEmpty: isPresent('[data-test-empty-allocations-list]'),
hasVolumes: isPresent('[data-test-volumes]'),
volumes: collection('[data-test-volumes] [data-test-volume]', {
name: text('[data-test-volume-name]'),
type: text('[data-test-volume-type]'),
source: text('[data-test-volume-source]'),
permissions: text('[data-test-volume-permissions]'),
}),
error: error(), error: error(),
emptyState: { emptyState: {