Browse Source

More tweaks to tests... just about ready to run at scale.

Adam Ierymenko 10 năm trước cách đây
mục cha
commit
4c24e0cfb0
3 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 1 0
      .gitignore
  2. 1 0
      tests/http/agent.js
  3. 5 5
      tests/http/server.js

+ 1 - 0
.gitignore

@@ -53,6 +53,7 @@ node_modules
 cluster-geo/cluster-geo/config.js
 cluster-geo/cluster-geo/config.js
 cluster-geo/cluster-geo/cache.*
 cluster-geo/cluster-geo/cache.*
 tests/http/zerotier-one
 tests/http/zerotier-one
+tests/http/result_*
 
 
 # MacGap wrapper build files
 # MacGap wrapper build files
 /ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcuserdata/*
 /ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcuserdata/*

+ 1 - 0
tests/http/agent.js

@@ -217,6 +217,7 @@ var expressServer = app.listen(AGENT_PORT,agentIdToIp(thisAgentId),function () {
 			console.error('FATAL: unable to contact or query server: '+err.toString());
 			console.error('FATAL: unable to contact or query server: '+err.toString());
 			process.exit(1);
 			process.exit(1);
 		}
 		}
+		doTestsAndReport();
 		setInterval(doTestsAndReport,TEST_INTERVAL);
 		setInterval(doTestsAndReport,TEST_INTERVAL);
 	});
 	});
 });
 });

+ 5 - 5
tests/http/server.js

@@ -41,15 +41,15 @@ app.post('/:testNumber/:agentId',function(req,res) {
 	}
 	}
 	result = {
 	result = {
 		agentId: agentId,
 		agentId: agentId,
-		testNumber: testNumber,
+		testNumber: parseInt(testNumber),
 		receiveTime: receiveTime,
 		receiveTime: receiveTime,
 		results: resultData
 		results: resultData
 	};
 	};
 
 
-	var nows = receiveTime.toString(16);
-	while (nows.length < 16)
-		nows = '0' + nows;
-	fs.writeFile('result_'+agentId+'_'+nows,JSON.stringify(result),function(err) {
+	testNumber = testNumber.toString();
+	while (testNumber.length < 10)
+		testNumber = '0' + testNumber;
+	fs.writeFile('result_'+testNumber+'_'+agentId,JSON.stringify(result),function(err) {
 		console.log(result);
 		console.log(result);
 	});
 	});