Web: rely on new attributes when determining task failure

Now that the job-output.json file has attributes for 'failed' or
'skipped' tasks, rely on those rather than hueristics for determining
the result of a task.

Change-Id: I2714c5a1776970d5339aafe2ca5e17abf5a3bb0b
This commit is contained in:
James E. Blair 2019-09-05 12:32:25 -07:00 committed by Clark Boylan
parent cfe6a7b985
commit 45318b4f19
3 changed files with 3 additions and 13 deletions

View File

@ -87,12 +87,6 @@ export function didTaskFail(task) {
if (task.failed) {
return true
}
if ('failed_when_result' in task && !task.failed_when_result) {
return false
}
if ('rc' in task && task.rc) {
return true
}
if (task.results) {
for (let result of task.results) {
if (didTaskFail(result)) {

View File

@ -17,10 +17,6 @@ import * as buildAction from './build'
it('processes job-output properly', () => {
expect(buildAction.didTaskFail({failed: true})).toEqual(true)
expect(buildAction.didTaskFail({failed_when_result: true})).toEqual(false)
expect(buildAction.didTaskFail({failed_when_result: false})).toEqual(false)
expect(buildAction.didTaskFail({failed: false, rc: 1})).toEqual(true)
expect(buildAction.didTaskFail({results: [{rc: 1}]})).toEqual(true)
expect(buildAction.hasInterestingKeys({rc: 42}, ['rc'])).toEqual(true)
expect(buildAction.hasInterestingKeys({noop: 42}, ['rc'])).toEqual(false)

View File

@ -156,13 +156,13 @@ class HostTask extends React.Component {
constructor (props) {
super(props)
const { host, task, taskPath, displayPath, errorIds } = this.props
const { host, taskPath, displayPath } = this.props
if (errorIds.has(task.task.id)) {
if (host.failed) {
this.state.failed = true
} else if (host.changed) {
this.state.changed = true
} else if (host.skip_reason) {
} else if (host.skipped) {
this.state.skipped = true
} else {
this.state.ok = true