Skip to content

Commit 19da0b5

Browse files
committedJul 14, 2015
Adding basic initial stress test
1 parent 7e8cb32 commit 19da0b5

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
 

‎stress-test/stress-test.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var worksmith = require('..')
2+
var _ = require('lodash')
3+
packageJson = require('../package.json')
4+
5+
console.log('Stress tests for worksmith version ', packageJson.version)
6+
7+
try {
8+
9+
worksmith.use("lodash", worksmith.createAdapter(require('lodash')))
10+
var workflow = worksmith("./stress-test/stress-workflows/workflow1.js")
11+
var ctx = {}
12+
workflow(ctx, function(err, results) { if (err) console.error('There was an error running a workflow: ', err.toString()) })
13+
14+
} catch(e) {
15+
console.error('There was an error configuring old data deletion: ', e)
16+
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module.exports = {
2+
"task": "sequence",
3+
"items": [
4+
{
5+
"task": "log",
6+
"message": "Stress test 1"
7+
},
8+
{
9+
"task": "set",
10+
"name": "startTime",
11+
"value": "[eval](new Date()).getTime()[/eval]"
12+
},
13+
{
14+
"task": "createDeepObjects",
15+
"taskPath": "/stress-test/tasks",
16+
"size": 1000,
17+
"depth": 3,
18+
"resultTo": "objectList"
19+
},
20+
{
21+
"task": "while",
22+
"test": "objectList.length > 0",
23+
"subflow": [
24+
{
25+
"task": "lodash/initial",
26+
"arguments": [ "@objectList" ],
27+
"resultTo": "objectList"
28+
}
29+
]
30+
},
31+
{
32+
"task": "set",
33+
"name": "duration",
34+
"value": "[eval](new Date()).getTime() - startTime[/eval]"
35+
},
36+
{
37+
"task": "log",
38+
"message": "[hbs]End of test. Duration: {{duration}} ms[/hbs]"
39+
}
40+
]
41+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var _ = require('lodash')
2+
3+
module.exports = function(definition) {
4+
return function build(context) {
5+
6+
execute.annotations = { inject: ['size', 'depth'] }
7+
8+
function execute(size, depth, done) {
9+
var objects = []
10+
_.times(size, function(n) { objects.push({ number: n }) })
11+
done(null, objects)
12+
}
13+
14+
return execute
15+
}
16+
}

0 commit comments

Comments
 (0)
Please sign in to comment.