Skip to content

Commit 434ee99

Browse files
committed
ui: fix tests for active tasks
1 parent 1542604 commit 434ee99

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

ui/tests/acceptance/exec-test.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ module('Acceptance | exec', function (hooks) {
2727
});
2828

2929
this.job.taskGroups.models.forEach((taskGroup) => {
30-
server.create('allocation', {
30+
const alloc = server.create('allocation', {
3131
jobId: this.job.id,
3232
taskGroup: taskGroup.name,
3333
forceRunningClientStatus: true,
3434
});
35+
server.db.taskStates.update(
36+
{ allocationId: alloc.id },
37+
{ state: 'running' }
38+
);
3539
});
3640
});
3741

@@ -135,12 +139,11 @@ module('Acceptance | exec', function (hooks) {
135139

136140
let runningTaskGroup = this.job.taskGroups.models.sortBy('name')[1];
137141
runningTaskGroup.tasks.models.forEach((task, index) => {
142+
let state = 'running';
138143
if (index > 0) {
139-
this.server.db.taskStates.update(
140-
{ name: task.name },
141-
{ finishedAt: new Date() }
142-
);
144+
state = 'dead';
143145
}
146+
this.server.db.taskStates.update({ name: task.name }, { state });
144147
});
145148

146149
await Exec.visitJob({ job: this.job.id });
@@ -159,12 +162,11 @@ module('Acceptance | exec', function (hooks) {
159162
let runningTaskGroup = this.job.taskGroups.models.sortBy('name')[1];
160163
let changingTaskStateName;
161164
runningTaskGroup.tasks.models.sortBy('name').forEach((task, index) => {
165+
let state = 'running';
162166
if (index > 0) {
163-
this.server.db.taskStates.update(
164-
{ name: task.name },
165-
{ finishedAt: new Date() }
166-
);
167+
state = 'dead';
167168
}
169+
this.server.db.taskStates.update({ name: task.name }, { state });
168170

169171
if (index === 1) {
170172
changingTaskStateName = task.name;
@@ -187,7 +189,7 @@ module('Acceptance | exec', function (hooks) {
187189
);
188190

189191
if (changingTaskState) {
190-
changingTaskState.set('finishedAt', undefined);
192+
changingTaskState.set('state', 'running');
191193
}
192194
});
193195

ui/tests/acceptance/task-detail-test.js

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ module('Acceptance | task detail', function (hooks) {
2222
allocation = server.create('allocation', 'withTaskWithPorts', {
2323
clientStatus: 'running',
2424
});
25+
server.db.taskStates.update(
26+
{ allocationId: allocation.id },
27+
{ state: 'running' }
28+
);
2529
task = server.db.taskStates.where({ allocationId: allocation.id })[0];
2630

2731
await Task.visit({ id: allocation.id, name: task.name });

0 commit comments

Comments
 (0)