Skip to content

Commit

Permalink
fix: emit taskComplete when adding cached tasks
Browse files Browse the repository at this point in the history
This clears the error and cancelled node states on the dashboard's stack
graph tab e.g. when reverting the underlying code to a
functioning/correct version that had previously been
built/deployed/tested during the execution of the current command.
  • Loading branch information
thsig committed Jul 10, 2019
1 parent 76c154b commit e1d49f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions garden-service/src/task-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ export class TaskGraph {
key: task.getKey(),
version: task.version,
})
} else {
const result = this.resultCache.get(task.getKey(), task.version.versionString)
if (result) {
this.garden.events.emit("taskComplete", result)
}
}
}

Expand Down
13 changes: 7 additions & 6 deletions garden-service/test/unit/src/task-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ interface TestTaskOptions {
throwError?: boolean
}

const testTaskVersion = {
versionString: "12345-6789",
dependencyVersions: {},
files: [],
}

class TestTask extends BaseTask {
type: TaskType = "test"
name: string
Expand Down Expand Up @@ -159,6 +153,13 @@ describe("task-graph", () => {
await graph.process([repeatedTask])

expect(garden.events.eventLog).to.eql([
{
name: "taskComplete",
payload: {
dependencyResults: {}, description: "a", key: task.getKey(), type: "test", name: "a",
output: { dependencyResults: {}, result: "result-a" },
},
},
{ name: "taskGraphProcessing", payload: { startedAt: now } },
{ name: "taskGraphComplete", payload: { completedAt: now } },
])
Expand Down

0 comments on commit e1d49f2

Please sign in to comment.