From 47eb9aa8cbda404cb458a1319f1a211a0db878a0 Mon Sep 17 00:00:00 2001 From: jonahss Date: Mon, 13 Feb 2017 19:43:53 -0500 Subject: [PATCH 1/2] let main be a function that passes in Index --- lib/bench-rest.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/bench-rest.js b/lib/bench-rest.js index 408ffd0..7bb2e43 100644 --- a/lib/bench-rest.js +++ b/lib/bench-rest.js @@ -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; @@ -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 = []; From 6498a641669e42375dc32c64210e9c9bcf781205 Mon Sep 17 00:00:00 2001 From: jonahss Date: Wed, 15 Feb 2017 12:18:46 -0500 Subject: [PATCH 2/2] 2.0.0 Jonah's changes --- README.md | 3 +++ package.json | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cfb2863..2232a82 100644 --- a/README.md +++ b/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. diff --git a/package.json b/package.json index 2d011d4..d0c4b44 100644 --- a/package.json +++ b/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 ", "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",