Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let 'main' be a function that passes in Index #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
@@ -1,3 +1,6 @@
# Forked
@jonahss is working on this fork. See: https://github.com/jeffbski/bench-rest/pull/29

# bench-rest benchmark REST API's

Node.js client module for easy load testing / benchmarking REST (HTTP/HTTPS) API's using a simple structure/DSL can create REST flows with setup and teardown and returns (measured) metrics.
Expand Down
8 changes: 2 additions & 6 deletions lib/bench-rest.js
Expand Up @@ -110,11 +110,11 @@ function benchmark(flow, runOptions) {
};

function pushOnQueue() {
var tokens = { INDEX: index };
var tokens = {INDEX: index}
queue.push({
env: { index: index, jar: request.jar(), user: runOptions.user, password: runOptions.password, etags: {}, iterCtx: {}, stats: stats },
beforeMain: bindSubtituteFnsWithTokens(flow.beforeMain, tokens),
main: bindSubtituteFnsWithTokens(flow.main, tokens),
main: typeof flow === 'function' ? flow(index).main : flow.main,
afterMain: bindSubtituteFnsWithTokens(flow.afterMain, tokens)
});
index += 1;
Expand Down Expand Up @@ -163,10 +163,6 @@ function ensureFlowProperties(flow) {
flow = { main: [flow] };
}

if (!Array.isArray(flow.main)) {
throw new Error('benchmark flow requires main operations, missing flow.main?');
}

if (!flow.before) flow.before = [];
if (!flow.after) flow.after = [];
if (!flow.beforeMain) flow.beforeMain = [];
Expand Down
8 changes: 4 additions & 4 deletions package.json
@@ -1,14 +1,14 @@
{
"name": "bench-rest",
"name": "bench-rest-jonahss",
"description": "bench-rest - benchmark REST (HTTP/HTTPS) API's. Node.js client module for easy load testing / benchmarking REST API' using a simple structure/DSL can create REST flows with setup and teardown and returns (measured) metrics.",
"version": "1.2.4",
"version": "2.0.0",
"author": "Jeff Barczewski <jeff.barczewski@gmail.com>",
"repository": {
"type": "git",
"url": "http://github.com/jeffbski/bench-rest.git"
"url": "http://github.com/jonahss/bench-rest.git"
},
"bugs": {
"url": "http://github.com/jeffbski/bench-rest/issues"
"url": "http://github.com/jonahss/bench-rest/issues"
},
"license": "MIT",
"main": "lib/bench-rest",
Expand Down