Test coverage for resource graph empty states

This commit is contained in:
Michael Lange
2018-12-10 17:28:35 -08:00
parent 453f11d0c6
commit bf9ff6ed8b
6 changed files with 48 additions and 4 deletions

View File

@@ -32,8 +32,8 @@
</div>
</div>
{{else}}
<div class="empty-message">
<h3 class="empty-message-headline">Allocation isn't running</h3>
<div data-test-resource-error class="empty-message">
<h3 data-test-resource-error-headline class="empty-message-headline">Allocation isn't running</h3>
<p class="empty-message-body">Only running allocations utilize resources.</p>
</div>
{{/if}}

View File

@@ -40,8 +40,8 @@
</div>
</div>
{{else}}
<div class="empty-message">
<h3 class="empty-message-headline">Task isn't running</h3>
<div data-test-resource-error class="empty-message">
<h3 data-test-resource-error-headline class="empty-message-headline">Task isn't running</h3>
<p class="empty-message-body">Only running tasks utilize resources.</p>
</div>
{{/if}}

View File

@@ -191,3 +191,24 @@ moduleForAcceptance('Acceptance | allocation detail (rescheduled)', {
test('when the allocation has been rescheduled, the reschedule events section is rendered', function(assert) {
assert.ok(Allocation.hasRescheduleEvents, 'Reschedule Events section exists');
});
moduleForAcceptance('Acceptance | allocation detail (not running)', {
beforeEach() {
server.create('agent');
node = server.create('node');
job = server.create('job', { createAllocations: false });
allocation = server.create('allocation', { clientStatus: 'pending' });
Allocation.visit({ id: allocation.id });
},
});
test('when the allocation is not running, the utilization graphs are replaced by an empty message', function(assert) {
assert.equal(Allocation.resourceCharts.length, 0, 'No resource charts');
assert.equal(
Allocation.resourceEmptyMessage,
"Allocation isn't running",
'Empty message is appropriate'
);
});

View File

@@ -271,3 +271,22 @@ test('breadcrumbs match jobs / job / task group / allocation / task', function(a
);
});
});
moduleForAcceptance('Acceptance | task detail (not running)', {
beforeEach() {
server.create('agent');
server.create('node');
server.create('namespace');
server.create('namespace', { id: 'other-namespace' });
server.create('job', { createAllocations: false, namespaceId: 'other-namespace' });
allocation = server.create('allocation', 'withTaskWithPorts', { clientStatus: 'complete' });
task = server.db.taskStates.where({ allocationId: allocation.id })[0];
Task.visit({ id: allocation.id, name: task.name });
},
});
test('when the allocation for a task is not running, the resource utilization graphs are replaced by an empty message', function(assert) {
assert.equal(Task.resourceCharts.length, 0, 'No resource charts');
assert.equal(Task.resourceEmptyMessage, "Task isn't running", 'Empty message is appropriate');
});

View File

@@ -28,6 +28,8 @@ export default create({
chartClass: attribute('class', '[data-test-percentage-chart] progress'),
}),
resourceEmptyMessage: text('[data-test-resource-error-headline]'),
tasks: collection('[data-test-task-row]', {
name: text('[data-test-name]'),
state: text('[data-test-state]'),

View File

@@ -30,6 +30,8 @@ export default create({
chartClass: attribute('class', '[data-test-percentage-chart] progress'),
}),
resourceEmptyMessage: text('[data-test-resource-error-headline]'),
hasAddresses: isPresent('[data-test-task-addresses]'),
addresses: collection('[data-test-task-address]', {
name: text('[data-test-task-address-name]'),