summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 18:01:23 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 18:01:23 -0800
commit32ec378e3b5e9c584d45c7316142c73c362dd032 (patch)
treee1986cf92feb930753290e1970444beb33459626 /tests
parent2cc50bdb10c0a7849763ae1dfa37ca7707299a16 (diff)
downloadinfinitytier-32ec378e3b5e9c584d45c7316142c73c362dd032.tar.gz
infinitytier-32ec378e3b5e9c584d45c7316142c73c362dd032.zip
Announce that we have peers on the cluster when we first see them to improve startup times, and add a result crunching script to tests/http.
Diffstat (limited to 'tests')
-rw-r--r--tests/http/crunch-results.js58
-rw-r--r--tests/http/server.js2
2 files changed, 59 insertions, 1 deletions
diff --git a/tests/http/crunch-results.js b/tests/http/crunch-results.js
new file mode 100644
index 00000000..85c021d7
--- /dev/null
+++ b/tests/http/crunch-results.js
@@ -0,0 +1,58 @@
+//
+// Pipe the output of server.js into this to convert raw test results into bracketed statistics
+// suitable for graphing.
+//
+
+// Average over this interval of time
+var GRAPH_INTERVAL = 60000;
+
+// Number of bytes expected from each test
+var EXPECTED_BYTES = 5000;
+
+var readline = require('readline');
+var rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ terminal: false
+});
+
+var startTS = 0;
+
+var count = 0.0;
+var totalFailures = 0;
+var totalPartialFailures = 0;
+var totalMs = 0;
+var totalData = 0;
+
+rl.on('line',function(line) {
+ line = line.trim();
+ var ls = line.split(',');
+ if (ls.length == 7) {
+ var ts = parseInt(ls[0]);
+ var from = ls[1];
+ var to = ls[2];
+ var ms = parseFloat(ls[3]);
+ var bytes = parseInt(ls[4]);
+ var timedOut = (ls[5] == 'true') ? true : false;
+ var errMsg = ls[6];
+
+ count += 1.0;
+ if ((bytes <= 0)||(timedOut))
+ ++totalFailures;
+ if (bytes !== EXPECTED_BYTES)
+ ++totalPartialFailures;
+ totalMs += ms;
+ totalData += bytes;
+
+ if (startTS === 0) {
+ startTS = ts;
+ } else if (((ts - startTS) >= GRAPH_INTERVAL)&&(count > 0.0)) {
+ console.log(count.toString()+','+(totalMs / count)+','+totalFailures+','+totalPartialFailures+','+totalData);
+
+ count = 0.0;
+ totalFailures = 0;
+ totalPartialFailures = 0;
+ totalMs = 0;
+ }
+ } // else ignore junk
+});
diff --git a/tests/http/server.js b/tests/http/server.js
index 57109392..1abe624b 100644
--- a/tests/http/server.js
+++ b/tests/http/server.js
@@ -30,7 +30,7 @@ app.post('/:agentId',function(req,res) {
var resultData = null;
try {
resultData = JSON.parse(req.rawBody);
- console.log(resultData.source+','+resultData.target+','+resultData.time+','+resultData.bytes+','+resultData.timedOut+',"'+((resultData.error) ? resultData.error : '')+'"');
+ console.log(Date.now()+','+resultData.source+','+resultData.target+','+resultData.time+','+resultData.bytes+','+resultData.timedOut+',"'+((resultData.error) ? resultData.error : '')+'"');
} catch (e) {}
}