-
Notifications
You must be signed in to change notification settings - Fork 1
/
apiExample.js
74 lines (63 loc) · 1.98 KB
/
apiExample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
Written by Kevin Gravier <https://github.com/mrkmg>
Part of the node-docker-test project. <https://github.com/mrkmg/node-docker-test>
MIT Licence
*/
var Promise = require('bluebird');
var ndt = require('./api.js');
var setupRunner, testRunner;
Promise
.try(function () {
return ndt.VersionParser(['6', 'minor | eq:5']);
})
.then(function (versions) {
setupRunner = new ndt.SetupRunner({
name: 'custom:runner',
'base-image': 'debian:latest',
versions: versions,
commands: [],
reset: false
});
testRunner = new ndt.TestRunner({
name: 'custom:runner',
versions: versions,
commands: ['sleep 5', 'echo "Test Running!"', 'sleep 5', 'echo "Test Done"'],
concurrency: 2
});
setupRunner.on('data', function (data) {
console.log(data);
});
testRunner.on('started', function () {
console.log('started');
});
testRunner.on('finished', function (results) {
console.log('finished', results);
});
testRunner.on('testStarted', function (test) {
console.log('testStarted', test);
});
testRunner.on('testData', function (test) {
console.log('testData', test);
});
testRunner.on('testFinished', function (test) {
console.log('testFinished', test);
});
testRunner.on('runnerStarted', function (runner) {
console.log('runnerStarted', runner);
});
testRunner.on('runnerFinished', function (runner) {
console.log('runnerFinished', runner);
});
})
// .then(function () {
// return setupRunner.start();
// })
.then(function () {
setTimeout(function () {
testRunner.stop();
}, 1000);
return testRunner.start();
})
.then(function (results) {
//results are here as well
});