Fix flaky lifecycle chart tests
This commit is contained in:
parent
f543137ec9
commit
c041236629
|
@ -103,6 +103,7 @@ module('Acceptance | allocation detail', function(hooks) {
|
|||
|
||||
const prestartEphemeralTask = server.db.taskStates
|
||||
.where({ allocationId: allocation.id })
|
||||
.sortBy('name')
|
||||
.find(taskState => {
|
||||
const task = server.db.tasks.findBy({ name: taskState.name });
|
||||
return task.Lifecycle && task.Lifecycle.Hook === 'prestart' && !task.Lifecycle.Sidecar;
|
||||
|
|
|
@ -37,8 +37,16 @@ module('Acceptance | task detail', function(hooks) {
|
|||
);
|
||||
|
||||
const lifecycle = server.db.tasks.where({ name: task.name })[0].Lifecycle;
|
||||
const prestartString = lifecycle && lifecycle.Sidecar ? 'sidecar' : 'prestart';
|
||||
assert.equal(Task.lifecycle, lifecycle ? prestartString : 'main');
|
||||
|
||||
let lifecycleName = 'main';
|
||||
if (lifecycle && (lifecycle.Hook === 'prestart' || lifecycle.Hook === 'poststart')) {
|
||||
lifecycleName = `${lifecycle.Hook}-${lifecycle.Sidecar ? 'sidecar' : 'ephemeral'}`;
|
||||
}
|
||||
if (lifecycle && lifecycle.Hook === 'poststop') {
|
||||
lifecycleName = 'poststop';
|
||||
}
|
||||
|
||||
assert.equal(Task.lifecycle, lifecycleName);
|
||||
|
||||
assert.equal(document.title, `Task ${task.name} - Nomad`);
|
||||
});
|
||||
|
|
|
@ -105,7 +105,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
|||
this.set('tasks', [tasks[0], tasks[6]]);
|
||||
|
||||
await render(hbs`<LifecycleChart @tasks={{tasks}} />`);
|
||||
assert.ok(Chart.phases.length, 4);
|
||||
assert.equal(Chart.phases.length, 4);
|
||||
});
|
||||
|
||||
test('it reflects phase and task states when states are passed in', async function(assert) {
|
||||
|
|
Loading…
Reference in a new issue