Skip to content

Instantly share code, notes, and snippets.

@gregarndt
Created March 25, 2015 02:21
Show Gist options
  • Save gregarndt/e04df60e89525bc6f919 to your computer and use it in GitHub Desktop.
Save gregarndt/e04df60e89525bc6f919 to your computer and use it in GitHub Desktop.
suite('Invalid payload schema', function() {
var co = require('co');
var testworker = require('../post_task');
var cmd = require('./helper/cmd');
test('invalid schema', co(function* () {
var result = yield testworker({
payload: {
image: 'taskcluster/test-ubuntu',
// No command is an invalid schema.
command: [],
features: { bufferLog: true },
maxRunTime: 5 * 60
}
});
assert.equal(result.run.state, 'exception', 'invalid schema should fail');
assert.equal(result.run.reasonResolved, 'malformed-payload', 'invalid schema should fail');
assert.ok(result.log.indexOf('schema errors' !== -1));
}));
test('invalid max runtime exceed max', co(function* () {
var result = yield testworker({
payload: {
image: 'taskcluster/test-ubuntu',
command: cmd("echo 'hi'"),
features: { bufferLog: true },
maxRunTime: 86401
}
});
assert.equal(result.run.state, 'exception', 'invalid schema should fail');
assert.equal(result.run.reasonResolved, 'malformed-payload', 'invalid schema should fail');
assert.ok(result.log.indexOf('schema errors' !== -1));
}));
test('invalid max runtime below minimum', co(function* () {
var result = yield testworker({
payload: {
image: 'taskcluster/test-ubuntu',
command: cmd("echo 'hi'"),
features: { bufferLog: true },
maxRunTime: 0
}
});
assert.equal(result.run.state, 'exception', 'invalid schema should fail');
assert.equal(result.run.reasonResolved, 'malformed-payload', 'invalid schema should fail');
assert.ok(result.log.indexOf('schema errors' !== -1));
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment