Created
March 25, 2015 02:21
-
-
Save gregarndt/e04df60e89525bc6f919 to your computer and use it in GitHub Desktop.
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
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