Skip to content

Commit

Permalink
fix: always return an executionDescription from sendTaskSuccess
Browse files Browse the repository at this point in the history
affects: statebox, tymly
  • Loading branch information
jezhiggins authored and exactlyaron committed Jun 13, 2018
1 parent 8551eb6 commit 2009585
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
14 changes: 6 additions & 8 deletions lib/plugin/components/services/statebox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ class StateboxService {
)

// hmm, should we be returning the execution description here?
if (authOk) {
return this.statebox.sendTaskSuccess(executionName, output)
} else {
throw new Error(errExecDesc.errorMessage)
}
return (authOk)
? this.statebox.sendTaskSuccess(executionName, output)
: errExecDesc
} // sendTaskSuccess

sendTaskHeartbeat (executionName, output, executionOptions, callback) {
Expand All @@ -151,11 +149,11 @@ class StateboxService {
return promiseOrCallback(p, callback)
} // waitUntilStoppedRunning

/*
authorisationCheck (stateMachineName, executionOptions, action) {
return [true] // STUB!
}

/*
*/
async authorisationCheck (userId, stateMachineName, executionOptions, action) {
const rbac = this.services.rbac

Expand Down Expand Up @@ -183,7 +181,7 @@ class StateboxService {
}
]
} // authorisationCheck
*/

} // class StateboxService

function addResources (statebox, options) {
Expand Down
13 changes: 7 additions & 6 deletions test/statebox-service-acl-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const heartBeatTests = [
}
]

xdescribe('statebox service RBAC authorisation tests', function () {
describe('statebox service RBAC authorisation tests', function () {
this.timeout(process.env.TIMEOUT || 5000)

let tymlyService
Expand Down Expand Up @@ -222,13 +222,14 @@ xdescribe('statebox service RBAC authorisation tests', function () {
})

it('sendTaskSuccess', async () => {
await statebox.sendTaskSuccess(
const execDesc = await statebox.sendTaskSuccess(
executionName,
{},
{
userId: allowed
}
)
expect(execDesc.status).to.eql('SUCCEEDED')
})
})
} // for allowed ...
Expand All @@ -251,16 +252,16 @@ xdescribe('statebox service RBAC authorisation tests', function () {
executionName = execDesc.executionName
})

it('sendTaskSuccess', (done) => {
statebox.sendTaskSuccess(
it('sendTaskSuccess', async () => {
const execDesc = await statebox.sendTaskSuccess(
executionName,
{},
{
userId: disallowed
}
)
.then(() => done(new Error('Should have failed!')))
.catch(() => done())

expect(execDesc.status).to.eql('FAILED')
})
})
} // for allowed ...
Expand Down

0 comments on commit 2009585

Please sign in to comment.