diff --git a/modules/tests-ui/models.js b/modules/tests-ui/models.js index 8416a0d14..5f5ab8f18 100644 --- a/modules/tests-ui/models.js +++ b/modules/tests-ui/models.js @@ -54,6 +54,8 @@ index: true }, + last_test_finished_at: Date, + // Special urls to test. Can be added manually or by tester when error occurs: to keep url in future sets. additional_test_urls: [String], @@ -152,4 +154,4 @@ export const PluginTest = db.model('PluginTest', PluginTestSchema); export const PageTestLog = db.model('PageTestLog', PageTestLogSchema); export const TestUrlsSet = db.model('TestUrlsSet', TestUrlsSetSchema); - export const TestingProgress = db.model('TestingProgress', TestingProgressSchema); \ No newline at end of file + export const TestingProgress = db.model('TestingProgress', TestingProgressSchema); diff --git a/modules/tests-ui/tester.js b/modules/tests-ui/tester.js index fae56f129..5201cdde1 100644 --- a/modules/tests-ui/tester.js +++ b/modules/tests-ui/tester.js @@ -346,7 +346,8 @@ function processPluginTests(pluginTest, plugin, count, cb) { if (urls.length == 0) { errors.push("No test urls specified"); } else if (!reachTestObjectFound) { - errors.push("No test feeds specified"); + // Keep tests cleaner. Hard to find feeds for all. + // errors.push("No test feeds specified"); } // TODO: add additional_test_urls. @@ -637,7 +638,12 @@ function testAll(cb) { var filterDate = new Date(new Date() - CONFIG.tests.plugin_test_period); pluginTests = pluginTests.filter(function(pluginTest) { - return !pluginTest.last_test_started_at || pluginTest.last_test_started_at < filterDate; + + // Started but never finished: process crashed or test errored. Re-run on restart. + var unfinished = pluginTest.last_test_started_at + && (!pluginTest.last_test_finished_at || pluginTest.last_test_finished_at < pluginTest.last_test_started_at); + + return unfinished || !pluginTest.last_test_started_at || pluginTest.last_test_started_at < filterDate; }); pluginTests.sort(function(a, b) { @@ -709,6 +715,7 @@ function testAll(cb) { pluginTest.error = error; } else { pluginTest.error = undefined; + pluginTest.last_test_finished_at = new Date(); } pluginTest.save() .then(data => { @@ -758,13 +765,18 @@ function testAll(cb) { }); } -function startTest() { +function startTest(isRerun) { testAll(function() { if (testOnePlugin) { process.exit(0); } + if (!isRerun) { + // Single re-run to pick up unfinished tests (filter will select only them). + return startTest(true); + } + setTimeout(function() { // Script should be restarted on that period to check new files version. process.exit(0);