You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by rk...@apache.org on 2016/02/12 19:51:18 UTC
cordova-medic git commit: CB-10433: Removing the ETIMEDOUT errors in
medic-run. This closes #76
Repository: cordova-medic
Updated Branches:
refs/heads/master ddcbd637c -> 94554b93a
CB-10433: Removing the ETIMEDOUT errors in medic-run. This closes #76
Also clarifying that no mobilespec results probably means crash
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/94554b93
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/94554b93
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/94554b93
Branch: refs/heads/master
Commit: 94554b93afb6721da6051bee520ea9fce72c0b3c
Parents: ddcbd63
Author: riknoll <ri...@gmail.com>
Authored: Mon Feb 8 18:28:50 2016 -0800
Committer: riknoll <ri...@gmail.com>
Committed: Fri Feb 12 10:33:47 2016 -0800
----------------------------------------------------------------------
lib/testwait.js | 26 ++++++++++++++++++++++----
medic/medic-run.js | 8 ++++----
2 files changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/94554b93/lib/testwait.js
----------------------------------------------------------------------
diff --git a/lib/testwait.js b/lib/testwait.js
index 67939f1..ee61a0e 100644
--- a/lib/testwait.js
+++ b/lib/testwait.js
@@ -25,6 +25,8 @@ var q = require("q");
var couchdb = require("./couchdb");
+var util = require("./util");
+
var mobilespec_results = null;
function init(uri) {
@@ -37,7 +39,6 @@ function query_for_sha(sha, callback) {
// get build errors from couch for each repo
mobilespec_results.query_view("results", view, function(error, result) {
if (error) {
- console.error("query failed for mobilespec_results", error);
callback(true, error);
return;
}
@@ -48,22 +49,39 @@ function query_for_sha(sha, callback) {
function isTestsCompleted(sha, callback) {
query_for_sha(sha, function (isFailed, res) {
// return True if there is no error and there are test results in db for specified sha
- callback(!isFailed && res.rows.length > 0);
+ callback(!isFailed && res.rows.length > 0, !isFailed);
});
}
-function waitTestsCompleted(sha, timeoutMs) {
+function waitTestsCompleted(sha, timeoutMs, silent) {
var defer = q.defer();
var startTime = Date.now();
var timeoutTime = startTime + timeoutMs;
var checkInterval = 10 * 1000; // 10 secs
+ // Stats for reporting
+ var totalChecks = 0;
+ var badChecks = 0;
+
var testFinishedFn = setInterval(function () {
- isTestsCompleted(sha, function (isSuccess) {
+ isTestsCompleted(sha, function (isSuccess, requestSuccess) {
+ totalChecks = totalChecks + 1;
+ if (!requestSuccess) {
+ badChecks = badChecks + 1;
+ }
+
// if tests are finished or timeout
if (isSuccess || Date.now() > timeoutTime) {
clearInterval(testFinishedFn);
+
+ if (!silent) {
+ util.medicLog("Finished polling for mobilespec results.");
+ util.medicLog(" Results Found: " + isSuccess);
+ util.medicLog(" Total attempts: " + totalChecks);
+ util.medicLog(" Failed attempts: " + badChecks);
+ }
+
if (isSuccess) {
defer.resolve();
} else {
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/94554b93/medic/medic-run.js
----------------------------------------------------------------------
diff --git a/medic/medic-run.js b/medic/medic-run.js
index d5cb44b..bdd03b8 100644
--- a/medic/medic-run.js
+++ b/medic/medic-run.js
@@ -318,7 +318,7 @@ function main() {
}
tryConnect(couchdbURI, MAX_NUMBER_OF_TRIES, function (){
- util.medicLog("it's up");
+ util.medicLog("it's up");
// modify the app to run autonomously
createMedicJson(appPath, buildId, couchdbURI);
@@ -338,13 +338,13 @@ function main() {
// timeout needs to be in milliseconds, but it's
// given in seconds, so we multiply by 1000
testwait.init(couchdbURI);
- testwait.waitTestsCompleted(buildId, timeout * 1000).then(
+ testwait.waitTestsCompleted(buildId, timeout * 1000, false).then(
function onFulfilled(value) {
- util.medicLog("got test results");
+ util.medicLog("Successfully found test results");
process.exit(0);
},
function onRejected(error) {
- console.error("didn't get test results: " + error);
+ console.error("Could not find test results. Check the output of medic-log to see if the app crashed before it could upload them to couchdb.");
process.exit(1);
}
);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org