-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from screwdriver-cd/queue
feat: add queue job config validation schema
- Loading branch information
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const Joi = require('joi'); | ||
const executor = require('./executor'); | ||
const SCHEMA_EXECUTOR_CONFIG = Joi.object().keys({ | ||
name: Joi.string().required(), | ||
options: Joi.object().required() | ||
}).required(); | ||
const SCHEMA_START = Joi.object().keys({ | ||
buildConfig: executor.start, | ||
executor: SCHEMA_EXECUTOR_CONFIG | ||
}).required(); | ||
|
||
module.exports = { | ||
/** | ||
* Validates the queue job config generated by the START method in executor-queue | ||
* | ||
* @property start | ||
* @type {Joi} | ||
*/ | ||
start: SCHEMA_START | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
buildConfig: | ||
buildId: 8609 | ||
container: node:4 | ||
apiUri: http://localhost:8080 | ||
token: eyJhbGciOiJIUziIsInR5cCI6IkpXVCJ9.eyJ1c2Vybam9obmpvaG5zb24iLCJzY29wZSI6WyJ1c2VyIl0sImlhdCI6MTQ3MDI2NjAwMywiZXhwIjoxNDcwMzA5MjAzfQ.CHaHW2-0wALpWaS4UTXQmSAn_ekMBml-ENEnGhw-9SE | ||
executor: | ||
name: k8s | ||
options: | ||
kubernetes: | ||
host: kubernetes.default | ||
launchVersion: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const assert = require('chai').assert; | ||
const queue = require('../../plugins/queue'); | ||
const validate = require('../helper').validate; | ||
|
||
describe('executor test', () => { | ||
describe('start', () => { | ||
it('validates the start', () => { | ||
assert.isNull(validate('queue.start.yaml', queue.start).error); | ||
}); | ||
|
||
it('fails the start for empty yaml', () => { | ||
assert.isNotNull(validate('empty.yaml', queue.start).error); | ||
}); | ||
}); | ||
}); |