Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0D2F418374 for ; Fri, 12 Feb 2016 18:51:19 +0000 (UTC) Received: (qmail 60221 invoked by uid 500); 12 Feb 2016 18:51:18 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 60200 invoked by uid 500); 12 Feb 2016 18:51:18 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 60176 invoked by uid 99); 12 Feb 2016 18:51:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Feb 2016 18:51:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7BA0EE03CD; Fri, 12 Feb 2016 18:51:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rknoll@apache.org To: commits@cordova.apache.org Message-Id: <02be6db2adc048369e469d7e575f365b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-medic git commit: CB-10433: Removing the ETIMEDOUT errors in medic-run. This closes #76 Date: Fri, 12 Feb 2016 18:51:18 +0000 (UTC) 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 Authored: Mon Feb 8 18:28:50 2016 -0800 Committer: riknoll 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