Update existing tests
This commit is contained in:
parent
5e95633481
commit
0f41bfafad
|
@ -30,7 +30,7 @@ export default Route.extend(WithWatchers, {
|
|||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('flagAsDraining', model.isDraining);
|
||||
controller.set('flagAsDraining', model && model.isDraining);
|
||||
|
||||
return this._super(...arguments);
|
||||
},
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
{{x-icon "info-circle-outline" class="is-faded"}}
|
||||
</span>
|
||||
</label>
|
||||
<span class="tag is-hollow is-small no-text-transform">
|
||||
<span data-test-node-id class="tag is-hollow is-small no-text-transform">
|
||||
{{model.id}}
|
||||
{{copy-button clipboardText=model.id}}
|
||||
</span>
|
||||
|
@ -178,15 +178,21 @@
|
|||
{{#if (not model.drainStrategy.hasNoDeadline)}}
|
||||
<span class="pair">
|
||||
<span class="term">Duration</span>
|
||||
<span data-test-duration class="tooltip" aria-label={{format-duration model.drainStrategy.deadline}}>
|
||||
{{format-duration model.drainStrategy.deadline}}
|
||||
</span>
|
||||
{{#if model.drainStrategy.isForced}}
|
||||
<span data-test-duration>--</span>
|
||||
{{else}}
|
||||
<span data-test-duration class="tooltip" aria-label={{format-duration model.drainStrategy.deadline}}>
|
||||
{{format-duration model.drainStrategy.deadline}}
|
||||
</span>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
<span class="pair">
|
||||
<span class="term">{{if model.drainStrategy.hasNoDeadline "Deadline" "Remaining"}}</span>
|
||||
{{#if model.drainStrategy.hasNoDeadline}}
|
||||
No deadline
|
||||
<span data-test-deadline>No deadline</span>
|
||||
{{else if model.drainStrategy.isForced}}
|
||||
<span data-test-deadline>--</span>
|
||||
{{else}}
|
||||
<span data-test-deadline class="tooltip" aria-label={{format-ts model.drainStrategy.forceDeadline}}>
|
||||
{{moment-from-now model.drainStrategy.forceDeadline interval=1000 hideAffix=true}}
|
||||
|
|
|
@ -209,14 +209,14 @@ export default function() {
|
|||
|
||||
this.post('/node/:id/eligibility', function({ nodes }, { params, requestBody }) {
|
||||
const body = JSON.parse(requestBody);
|
||||
const node = nodes.find({ id: params.id });
|
||||
const node = nodes.find(params.id);
|
||||
|
||||
node.update({ schedulingEligibility: body.Elibility === 'eligible' });
|
||||
return this.serialize(node);
|
||||
});
|
||||
|
||||
this.post('/node/:id/drain', function({ nodes }, { params }) {
|
||||
return this.serialize(nodes.find({ id: params.id }));
|
||||
return this.serialize(nodes.find(params.id));
|
||||
});
|
||||
|
||||
this.get('/allocations');
|
||||
|
|
|
@ -4,7 +4,6 @@ import { module, test } from 'qunit';
|
|||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import { setupMirage } from 'ember-cli-mirage/test-support';
|
||||
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
|
||||
import formatDuration from 'nomad-ui/utils/format-duration';
|
||||
import moment from 'moment';
|
||||
import ClientDetail from 'nomad-ui/tests/pages/clients/detail';
|
||||
import Clients from 'nomad-ui/tests/pages/clients/list';
|
||||
|
@ -58,7 +57,12 @@ module('Acceptance | client detail', function(hooks) {
|
|||
await ClientDetail.visit({ id: node.id });
|
||||
|
||||
assert.ok(ClientDetail.title.includes(node.name), 'Title includes name');
|
||||
assert.ok(ClientDetail.title.includes(node.id), 'Title includes id');
|
||||
assert.ok(ClientDetail.clientId.includes(node.id), 'Title includes id');
|
||||
assert.equal(
|
||||
ClientDetail.statusLight.objectAt(0).id,
|
||||
node.status,
|
||||
'Title includes status light'
|
||||
);
|
||||
});
|
||||
|
||||
test('/clients/:id should list additional detail for the node below the title', async function(assert) {
|
||||
|
@ -472,23 +476,19 @@ module('Acceptance | client detail', function(hooks) {
|
|||
await ClientDetail.visit({ id: node.id });
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.deadline.includes(formatDuration(deadline)),
|
||||
ClientDetail.drainDetails.deadline.includes(forceDeadline.fromNow(true)),
|
||||
'Deadline is shown in a human formatted way'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.forcedDeadline.includes(forceDeadline.format("MMM DD, 'YY HH:mm:ss ZZ")),
|
||||
'Force deadline is shown as an absolute date'
|
||||
assert.equal(
|
||||
ClientDetail.drainDetails.deadlineTooltip,
|
||||
forceDeadline.format("MMM DD, 'YY HH:mm:ss ZZ"),
|
||||
'The tooltip for deadline shows the force deadline as an absolute date'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.forcedDeadline.includes(forceDeadline.fromNow()),
|
||||
'Force deadline is shown as a relative date'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.ignoreSystemJobs.endsWith('No'),
|
||||
'Ignore System Jobs state is shown'
|
||||
ClientDetail.drainDetails.drainSystemJobsText.endsWith('Yes'),
|
||||
'Drain System Jobs state is shown'
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -507,19 +507,16 @@ module('Acceptance | client detail', function(hooks) {
|
|||
|
||||
await ClientDetail.visit({ id: node.id });
|
||||
|
||||
assert.notOk(ClientDetail.drainDetails.durationIsShown, 'Duration is omitted');
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.deadline.includes('No deadline'),
|
||||
ClientDetail.drainDetails.deadline.includes('No deadline'),
|
||||
'The value for Deadline is "no deadline"'
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
ClientDetail.drain.hasForcedDeadline,
|
||||
'Forced deadline is not shown since there is no forced deadline'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.ignoreSystemJobs.endsWith('Yes'),
|
||||
'Ignore System Jobs state is shown'
|
||||
ClientDetail.drainDetails.drainSystemJobsText.endsWith('No'),
|
||||
'Drain System Jobs state is shown'
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -538,17 +535,18 @@ module('Acceptance | client detail', function(hooks) {
|
|||
|
||||
await ClientDetail.visit({ id: node.id });
|
||||
|
||||
assert.equal(ClientDetail.drain.badgeLabel, 'Forced Drain', 'Forced Drain badge is described');
|
||||
assert.ok(ClientDetail.drain.badgeIsDangerous, 'Forced Drain is shown in a red badge');
|
||||
|
||||
assert.notOk(
|
||||
ClientDetail.drain.hasForcedDeadline,
|
||||
'Forced deadline is not shown since there is no forced deadline'
|
||||
assert.ok(
|
||||
ClientDetail.drainDetails.forceDrainText.endsWith('Yes'),
|
||||
'Forced Drain is described'
|
||||
);
|
||||
|
||||
assert.ok(ClientDetail.drainDetails.duration.includes('--'), 'Duration is shown but unset');
|
||||
|
||||
assert.ok(ClientDetail.drainDetails.deadline.includes('--'), 'Deadline is shown but unset');
|
||||
|
||||
assert.ok(
|
||||
ClientDetail.drain.ignoreSystemJobs.endsWith('No'),
|
||||
'Ignore System Jobs state is shown'
|
||||
ClientDetail.drainDetails.drainSystemJobsText.endsWith('Yes'),
|
||||
'Drain System Jobs state is shown'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,6 +27,7 @@ export default create({
|
|||
},
|
||||
|
||||
title: text('[data-test-title]'),
|
||||
clientId: text('[data-test-node-id]'),
|
||||
|
||||
statusLight: collection('[data-test-node-status]', {
|
||||
id: attribute('data-test-node-status'),
|
||||
|
@ -99,8 +100,10 @@ export default create({
|
|||
durationIsPresent: isPresent('[data-test-duration]'),
|
||||
duration: text('[data-test-duration]'),
|
||||
durationTooltip: attribute('aria-label', '[data-test-duration]'),
|
||||
durationIsShown: isPresent('[data-test-duration]'),
|
||||
deadline: text('[data-test-deadline]'),
|
||||
deadlineTooltip: attribute('aria-label', '[data-test-deadline]'),
|
||||
deadlineIsShown: isPresent('[data-test-deadline]'),
|
||||
forceDrainText: text('[data-test-force-drain-text]'),
|
||||
drainSystemJobsText: text('[data-test-drain-system-jobs-text]'),
|
||||
|
||||
|
|
Loading…
Reference in New Issue