Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.

Commit 86b77a8

Browse files
committed
Add Dino
1 parent e2e1d06 commit 86b77a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4342
-6
lines changed

LICENSE.txt

+353
Large diffs are not rendered by default.

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
```
2-
Project Dino - massive scale load tests from AWS Lambda
3-
```
1+
# Project Dino - massive scale load tests from AWS Lambda
42

53
## Usage
64

5+
Set up an IAM user and a role first and add the credentials to `~/.aws/credentials` under `[dino]`. Then run:
6+
77
```
88
$ npm install -g artillery-dino
9-
$ dino setup
10-
$ dino -n 500 -c 10 -l 20 -t http://dev.myapp.io/
9+
$ AWS_PROFILE=dino dino setup
10+
$ AWS_PROFILE=dino dino -n 500 -c 10 -l 20 -t http://dev.myapp.io/
1111
```
1212

1313
For more information read my blog post: [Project Dino - Load testing on Lambda with Artillery](http://veldstra.org/2016/02/18/project-dino-load-testing-on-lambda-with-artillery.html).
1414

15+
## Contact
16+
17+
18+
1519
## License
1620

17-
MPL v2
21+
MPLv2 - see [LICENSE.txt](./LICENSE.txt) for details
22+
23+
(Note: several dependencies are bundled under `lambda/out/node_modules` -- the above MPLv2 declaration does not apply to those.)

bin/dino

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env node
2+
3+
/* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
var yargs = require('yargs');
9+
var commands = require('../lib/commands');
10+
11+
var argv = yargs.usage('Usage: $0 <command> [options]')
12+
.demand(1)
13+
.command('setup', 'Set up the necessary AWS infrastructure', commands.setup)
14+
.command('run', 'Run a test', commands.run)
15+
.help('help')
16+
.epilog('Dino is an experimental project by https://artillery.io')
17+
.argv;

lambda.zip

23.8 MB
Binary file not shown.

lambda/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Contents:
2+
- `index.js` is the source for the lambda function
3+
- `out` is [`dino-core`](https://github.com/hassy/dino-core) transpiled to ES5 with Babel (`dino-core` itself is a stripped down version of [`artillery-core`](https://github.com/shoreditch-ops/artillery-core))
4+
- `dino_lambda.zip` is the above zipped up for convenience - this is the zip that gets uploaded to Lambda

lambda/index.js

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* The source code in this file is distributed under the terms of the
3+
* Apache License, Version 2.0. You may obtain a copy of the License at
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
*/
7+
8+
'use strict';
9+
10+
var aws = require('aws-sdk');
11+
var runner = require('./out').runner;
12+
13+
var sns = new aws.SNS();
14+
15+
function publish(arn, msg, cb) {
16+
var params = {
17+
TopicArn: arn,
18+
Message: msg
19+
};
20+
21+
return sns.publish(params, cb);
22+
}
23+
24+
module.exports.handler = function(event, context) {
25+
var script = event.script;
26+
var uid = event.uid;
27+
var topicArn = event.TopicArn;
28+
29+
var response = {
30+
intermediate: 0,
31+
uid: uid
32+
};
33+
34+
console.log('event:\n%s', JSON.stringify(event, null, 2));
35+
36+
var ee = runner(script);
37+
38+
ee.on('stats', function(stats) {
39+
response.intermediate++;
40+
publish(topicArn,
41+
JSON.stringify({uid: uid, stats: stats, type: 'intermediate'}),
42+
function(err, data) {
43+
if (err) {
44+
console.log(err, err.stack);
45+
context.done(err, null);
46+
}
47+
console.log('stats pushed to SQS');
48+
});
49+
});
50+
51+
ee.on('done', function(stats) {
52+
stats.intermediate = [];
53+
stats.latencies = [];
54+
if (stats.aggregate) {
55+
stats.aggregate.latencies = []; // otherwise will go over 256kb for longer tests - can still reconstruct from intermediates on the client
56+
}
57+
58+
publish(topicArn,
59+
JSON.stringify({uid: uid, stats: stats, type: 'final'}),
60+
function(err, data) {
61+
if (err) {
62+
console.log(err, err.stack);
63+
response.stats = stats;
64+
publish(topicArn,
65+
JSON.stringify({uid: uid, stats: {}}),
66+
function() {});
67+
context.done(err, response);
68+
}
69+
console.log('done');
70+
context.done(null, response);
71+
});
72+
});
73+
74+
ee.run();
75+
};

lambda/out/.eslintrc

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es6": true
5+
},
6+
"globals": {
7+
"expect": true
8+
},
9+
"rules": {
10+
// Ignore Rules
11+
"strict": 0,
12+
"no-underscore-dangle": 0,
13+
"no-mixed-requires": 0,
14+
"no-use-before-define": 0,
15+
"no-process-exit": 0,
16+
17+
// Warnings
18+
"no-debugger": 1,
19+
"no-empty": 1,
20+
"no-invalid-regexp": 1,
21+
"no-warning-comments": 1,
22+
"no-unused-expressions": 1,
23+
"no-native-reassign": 1,
24+
"no-fallthrough": 1,
25+
"camelcase": 1,
26+
"no-unused-vars": 1,
27+
28+
// Errors
29+
"no-undef": 2,
30+
"no-dupe-keys": 2,
31+
"no-empty-character-class": 2,
32+
"no-self-compare": 2,
33+
"valid-typeof": 2,
34+
"handle-callback-err": 2,
35+
"no-shadow-restricted-names": 2,
36+
"radix": 2,
37+
"no-new-require": 2,
38+
"no-mixed-spaces-and-tabs": 2,
39+
40+
// stylistic errors
41+
"new-cap": 2,
42+
"no-spaced-func": 2,
43+
"semi-spacing": 2,
44+
"quotes": [1, "single"]
45+
}
46+
}

lambda/out/.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.idea
2+
*.iml
3+
npm-debug.log
4+
dump.rdb
5+
node_modules
6+
components
7+
build
8+
results.tap
9+
results.xml
10+
config.json
11+
.DS_Store
12+
*/.DS_Store
13+
*/*/.DS_Store
14+
._*
15+
*/._*
16+
*/*/._*
17+
coverage.*
18+
lib-cov
19+
*scratch*
20+
minigun_report*
21+
coverage/*
22+
node_modules

lambda/out/.jscsrc

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"requireCurlyBraces": [
3+
"if",
4+
"else",
5+
"for",
6+
"while",
7+
"do",
8+
"try",
9+
"catch"
10+
],
11+
"requireOperatorBeforeLineBreak": true,
12+
"requireCamelCaseOrUpperCaseIdentifiers": true,
13+
"maximumLineLength": {
14+
"value": 80,
15+
"allowComments": true,
16+
"allowRegex": true
17+
},
18+
"validateIndentation": 2,
19+
"validateQuoteMarks": "'",
20+
21+
"disallowMultipleLineStrings": true,
22+
"disallowMixedSpacesAndTabs": true,
23+
"disallowTrailingWhitespace": true,
24+
"disallowSpaceAfterPrefixUnaryOperators": true,
25+
"disallowMultipleVarDecl": true,
26+
"disallowKeywordsOnNewLine": ["else"],
27+
28+
"requireSpaceAfterKeywords": [
29+
"if",
30+
"else",
31+
"for",
32+
"while",
33+
"do",
34+
"switch",
35+
"return",
36+
"try",
37+
"catch"
38+
],
39+
"requireSpaceBeforeBinaryOperators": [
40+
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
41+
"&=", "|=", "^=", "+=",
42+
43+
"+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
44+
"|", "^", "&&", "||", "===", "==", ">=",
45+
"<=", "<", ">", "!=", "!=="
46+
],
47+
"requireSpaceAfterBinaryOperators": true,
48+
"requireSpacesInConditionalExpression": true,
49+
"requireSpaceBeforeBlockStatements": true,
50+
"requireSpacesInForStatement": true,
51+
"requireLineFeedAtFileEnd": true,
52+
"requireSpacesInFunctionExpression": {
53+
"beforeOpeningCurlyBrace": true
54+
},
55+
"disallowSpacesInAnonymousFunctionExpression": {
56+
"beforeOpeningRoundBrace": true
57+
},
58+
"disallowSpacesInsideObjectBrackets": "all",
59+
"disallowSpacesInsideArrayBrackets": "all",
60+
"disallowSpacesInsideParentheses": true,
61+
62+
"disallowMultipleLineBreaks": true,
63+
"disallowNewlineBeforeBlockStatements": true
64+
}

lambda/out/.npmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
test/
2+
.idea
3+
*.iml
4+
npm-debug.log
5+
dump.rdb
6+
node_modules
7+
components
8+
build
9+
results.tap
10+
results.xml
11+
config.json
12+
.DS_Store
13+
*/.DS_Store
14+
*/*/.DS_Store
15+
._*
16+
*/._*
17+
*/*/._*
18+
coverage.*
19+
lib-cov
20+
*scratch*
21+
minigun_report*
22+
coverage/*
23+
node_modules

lambda/out/.travis.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: node_js
2+
sudo: false
3+
env:
4+
- CXX=g++-4.8
5+
node_js:
6+
- "4.2"
7+
addons:
8+
apt:
9+
sources:
10+
- ubuntu-toolchain-r-test
11+
packages:
12+
- gcc-4.8
13+
- g++-4.8

0 commit comments

Comments
 (0)