Commit 99244af1 authored by Michael Lange's avatar Michael Lange
Browse files

Fix flaky lifecycle chart tests

parent edd296ff
Showing with 12 additions and 3 deletions
+12 -3
...@@ -103,6 +103,7 @@ module('Acceptance | allocation detail', function(hooks) { ...@@ -103,6 +103,7 @@ module('Acceptance | allocation detail', function(hooks) {
const prestartEphemeralTask = server.db.taskStates const prestartEphemeralTask = server.db.taskStates
.where({ allocationId: allocation.id }) .where({ allocationId: allocation.id })
.sortBy('name')
.find(taskState => { .find(taskState => {
const task = server.db.tasks.findBy({ name: taskState.name }); const task = server.db.tasks.findBy({ name: taskState.name });
return task.Lifecycle && task.Lifecycle.Hook === 'prestart' && !task.Lifecycle.Sidecar; return task.Lifecycle && task.Lifecycle.Hook === 'prestart' && !task.Lifecycle.Sidecar;
......
...@@ -37,8 +37,16 @@ module('Acceptance | task detail', function(hooks) { ...@@ -37,8 +37,16 @@ module('Acceptance | task detail', function(hooks) {
); );
const lifecycle = server.db.tasks.where({ name: task.name })[0].Lifecycle; 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`); assert.equal(document.title, `Task ${task.name} - Nomad`);
}); });
......
...@@ -105,7 +105,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) { ...@@ -105,7 +105,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
this.set('tasks', [tasks[0], tasks[6]]); this.set('tasks', [tasks[0], tasks[6]]);
await render(hbs`<LifecycleChart @tasks={{tasks}} />`); 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) { test('it reflects phase and task states when states are passed in', async function(assert) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment