Created
December 11, 2015 14:54
-
-
Save gregarndt/f393aa03136775a20d11 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
import assert from 'assert'; | |
import DockerWorker from '../dockerworker'; | |
import TestWorker from '../testworker'; | |
suite('allow ptrace', () => { | |
let worker; | |
setup(async () => { | |
worker = new TestWorker(DockerWorker); | |
await worker.launch(); | |
}); | |
teardown(async () => { | |
if (worker) { | |
await worker.terminate(); | |
worker = null; | |
} | |
}); | |
test('ptrace enabled', async () => { | |
let result = await worker.postToQueue({ | |
scopes: ['docker-worker:feature:allowPtrace'], | |
payload: { | |
image: 'taskcluster/test-ubuntu', | |
command: [ | |
'bash', | |
'-c', | |
'ls /' | |
], | |
features: { | |
allowPtrace: true | |
}, | |
maxRunTime: 5 * 60 | |
} | |
}); | |
assert.equal(result.run.state, 'completed', 'task should be successful'); | |
assert.equal(result.run.reasonResolved, 'completed', | |
'task should be successful'); | |
}); | |
test('missing feature scope', async () => { | |
let result = await worker.postToQueue({ | |
payload: { | |
features: { | |
allowPtrace: true | |
}, | |
image: 'taskcluster/test-ubuntu', | |
command: [ | |
'/bin/bash', | |
'-c', | |
'ls' | |
], | |
maxRunTime: 5 * 60 | |
} | |
}); | |
assert.ok( | |
result.log.includes('[taskcluster:error] Task was aborted because states'), | |
'Error does not container message about states being aborted' | |
); | |
assert.ok( | |
result.log.includes('Error calling \'link\' for balrogVPNProxy'), | |
'Error does not contain the name of the feature' | |
); | |
assert.ok( | |
result.log.includes('Insufficient scopes to use \'allowPtrace\''), | |
'Error does not contain message about insufficient scopes' | |
); | |
assert.equal(result.status.state, 'failed', 'Task not marked as failed'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment