From 07c1b4ddee1b6ba1a4399dc62c8e3c6f5367afa0 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 28 Oct 2015 14:16:58 -0700 Subject: test stuff --- tests/http/Dockerfile | 2 +- tests/http/agent.js | 148 ++++++++++++++++++++++------------------------ tests/http/docker-main.sh | 7 ++- tests/http/server.js | 6 +- 4 files changed, 83 insertions(+), 80 deletions(-) mode change 100644 => 100755 tests/http/docker-main.sh (limited to 'tests') diff --git a/tests/http/Dockerfile b/tests/http/Dockerfile index 02578cd5..7bba2fc0 100644 --- a/tests/http/Dockerfile +++ b/tests/http/Dockerfile @@ -17,7 +17,7 @@ ADD zerotier-one / RUN chmod a+x /zerotier-one ADD agent.js / -ADD main.sh / +ADD docker-main.sh / RUN chmod a+x /docker-main.sh CMD ["./docker-main.sh"] diff --git a/tests/http/agent.js b/tests/http/agent.js index 34837411..465a2e28 100644 --- a/tests/http/agent.js +++ b/tests/http/agent.js @@ -1,14 +1,13 @@ // --------------------------------------------------------------------------- // Customizable parameters: -// How frequently in ms to run tests -//var RUN_TEST_EVERY = (60 * 5 * 1000); -var RUN_TEST_EVERY = 1000; +// Maximum test duration in milliseconds +var TEST_DURATION = (30 * 1000); -// Maximum test duration in milliseconds (must be less than RUN_TEST_EVERY) -var TEST_DURATION = (60 * 1000); +// Interval between tests (should be several times longer than TEST_DURATION) +var TEST_INTERVAL = (60 * 2 * 1000); -// Where should I contact to register and query a list of other nodes? +// Where should I contact to register and query a list of other test agents? var SERVER_HOST = '174.136.102.178'; var SERVER_PORT = 18080; @@ -71,8 +70,29 @@ for(var xx=0;xx>agent.out 2>&1 diff --git a/tests/http/server.js b/tests/http/server.js index a58756bc..6211b4ee 100644 --- a/tests/http/server.js +++ b/tests/http/server.js @@ -26,7 +26,8 @@ app.get('/:agentId',function(req,res) { return res.status(200).send(JSON.stringify(Object.keys(knownAgents))); }); -app.post('/:agentId',function(req,res) { +app.post('/:testNumber/:agentId',function(req,res) { + var testNumber = req.params.testNumber; var agentId = req.params.agentId; if ((!agentId)||(agentId.length !== 32)) return res.status(404).send(''); @@ -40,8 +41,9 @@ app.post('/:agentId',function(req,res) { } result = { agentId: agentId, + testNumber: testNumber, receiveTime: receiveTime, - result: resultData + results: resultData }; var nows = receiveTime.toString(16); -- cgit v1.2.3