mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 09:26:14 -04:00
* remote_runner.js: fix drain call (cf. https://github.com/caolan/async/blob/master/CHANGELOG.md#breaking-changes) * dont wait 30 seconds after remote_runner.js returned * timeout frontend tests after 9.5 minutes to prevent travis from silently stop them * log when not all tests finished * prevent killTimeout to happen after last test * log server messages to console * remote_runner will take some time to setup sl, so this second is not necessary * dont write to global mocha variable * mochas `test end` event is not called when a before/beforeEach-hooks failed, so we should only use pass/fail/pending-hooks for logging. also some cruft removed * pass test in `pending`-event handler * remove some more cruft in tests/frontend/runner.js * frontend tests: clarify why stats.tests and total differ * move killTimeout to pass/fail/pending instead of `test end` to guarantee that it is run * delete killTimeout on test end to prevent misleading log message * unused variable * fix regex * unlikely edge case * ensure `allowed test duration exceeded` message is printed for the last runner * get rid of jquery.iframe.js, currently no support for IE<9 * retry up to 3 times when pad could not be loaded * Call the logging code in stopSauce in a callback for `browser.quit()`. This should fix cases like https://app.saucelabs.com/tests/cb8225375d274cbcbb091309f5466cfd Travis received all the logs and remote_runner.js exits, but there never is a DELETE command for webdriver.
This commit is contained in:
parent
859a128c54
commit
1b6a9d8be0
7 changed files with 106 additions and 132 deletions
|
@ -25,35 +25,41 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
|
|||
console.log("Remote sauce test '" + name + "' started! " + url);
|
||||
|
||||
//tear down the test excecution
|
||||
var stopSauce = function(success){
|
||||
getStatusInterval && clearInterval(getStatusInterval);
|
||||
var stopSauce = function(success,timesup){
|
||||
clearInterval(getStatusInterval);
|
||||
clearTimeout(timeout);
|
||||
|
||||
browser.quit();
|
||||
browser.quit(function(){
|
||||
if(!success){
|
||||
allTestsPassed = false;
|
||||
}
|
||||
|
||||
if(!success){
|
||||
allTestsPassed = false;
|
||||
}
|
||||
// if stopSauce is called via timeout (in contrast to via getStatusInterval) than the log of up to the last
|
||||
// five seconds may not be available here. It's an error anyway, so don't care about it.
|
||||
var testResult = knownConsoleText.replace(/\[red\]/g,'\x1B[31m').replace(/\[yellow\]/g,'\x1B[33m')
|
||||
.replace(/\[green\]/g,'\x1B[32m').replace(/\[clear\]/g, '\x1B[39m');
|
||||
testResult = testResult.split("\\n").map(function(line){
|
||||
return "[" + testSettings.browserName + " " + testSettings.platform + (testSettings.version === "" ? '' : (" " + testSettings.version)) + "] " + line;
|
||||
}).join("\n");
|
||||
|
||||
var testResult = knownConsoleText.replace(/\[red\]/g,'\x1B[31m').replace(/\[yellow\]/g,'\x1B[33m')
|
||||
.replace(/\[green\]/g,'\x1B[32m').replace(/\[clear\]/g, '\x1B[39m');
|
||||
testResult = testResult.split("\\n").map(function(line){
|
||||
return "[" + testSettings.browserName + " " + testSettings.platform + (testSettings.version === "" ? '' : (" " + testSettings.version)) + "] " + line;
|
||||
}).join("\n");
|
||||
console.log(testResult);
|
||||
if (timesup) {
|
||||
console.log("[" + testSettings.browserName + " " + testSettings.platform + (testSettings.version === "" ? '' : (" " + testSettings.version)) + "] allowed test duration exceeded");
|
||||
}
|
||||
console.log("Remote sauce test '" + name + "' finished! " + url);
|
||||
|
||||
console.log(testResult);
|
||||
console.log("Remote sauce test '" + name + "' finished! " + url);
|
||||
|
||||
callback();
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* timeout for the case the test hangs
|
||||
* timeout if a test hangs or the job exceeds 9.5 minutes
|
||||
* It's necessary because if travis kills the saucelabs session due to inactivity, we don't get any output
|
||||
* @todo this should be configured in testSettings, see https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-Timeouts
|
||||
*/
|
||||
var timeout = setTimeout(function(){
|
||||
stopSauce(false);
|
||||
}, 1200000 * 10);
|
||||
stopSauce(false,true);
|
||||
}, 570000); // travis timeout is 10 minutes, set this to a slightly lower value
|
||||
|
||||
var knownConsoleText = "";
|
||||
var getStatusInterval = setInterval(function(){
|
||||
|
@ -64,11 +70,13 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
|
|||
knownConsoleText = consoleText;
|
||||
|
||||
if(knownConsoleText.indexOf("FINISHED") > 0){
|
||||
let match = knownConsoleText.match(/FINISHED - ([0-9]+) tests passed, ([0-9]+) tests failed/);
|
||||
if (match[2] && match[2] == 0){
|
||||
let match = knownConsoleText.match(/FINISHED.*([0-9]+) tests passed, ([0-9]+) tests failed/);
|
||||
// finished without failures
|
||||
if (match[2] && match[2] == '0'){
|
||||
stopSauce(true);
|
||||
}
|
||||
else {
|
||||
|
||||
// finished but some tests did not return or some tests failed
|
||||
} else {
|
||||
stopSauce(false);
|
||||
}
|
||||
}
|
||||
|
@ -128,8 +136,6 @@ sauceTestWorker.push({
|
|||
, 'version' : '78.0'
|
||||
});
|
||||
|
||||
sauceTestWorker.drain = function() {
|
||||
setTimeout(function(){
|
||||
process.exit(allTestsPassed ? 0 : 1);
|
||||
}, 3000);
|
||||
}
|
||||
sauceTestWorker.drain(function() {
|
||||
process.exit(allTestsPassed ? 0 : 1);
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ cd "${MY_DIR}/../../../"
|
|||
# This is possible because the "install" section of .travis.yml already contains
|
||||
# a call to bin/installDeps.sh
|
||||
echo "Running Etherpad directly, assuming bin/installDeps.sh has already been run"
|
||||
node node_modules/ep_etherpad-lite/node/server.js "${@}" > /dev/null &
|
||||
node node_modules/ep_etherpad-lite/node/server.js "${@}" &
|
||||
|
||||
echo "Now I will try for 15 seconds to connect to Etherpad on http://localhost:9001"
|
||||
|
||||
|
@ -30,9 +30,6 @@ echo "Now I will try for 15 seconds to connect to Etherpad on http://localhost:9
|
|||
|
||||
echo "Successfully connected to Etherpad on http://localhost:9001"
|
||||
|
||||
# just in case, let's wait for another second before going on
|
||||
sleep 1
|
||||
|
||||
# On the Travis VM, remote_runner.js is found at
|
||||
# /home/travis/build/ether/[secure]/tests/frontend/travis/remote_runner.js
|
||||
# which is the same directory that contains this script.
|
||||
|
@ -46,8 +43,6 @@ echo "Now starting the remote runner"
|
|||
node remote_runner.js
|
||||
exit_code=$?
|
||||
|
||||
kill $!
|
||||
kill $(cat /tmp/sauce.pid)
|
||||
sleep 30
|
||||
|
||||
exit $exit_code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue