Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/tests-ui/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],

Expand Down Expand Up @@ -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);
export const TestingProgress = db.model('TestingProgress', TestingProgressSchema);
18 changes: 15 additions & 3 deletions modules/tests-ui/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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);
Expand Down
Loading