Fix truncation in travis (#4479)

* log to travis every five seconds
* travis: kill etherpad process after tests
pull/4482/head
webzwo0i 2020-11-10 06:59:50 +01:00 committed by GitHub
parent f0da3a0c4c
commit f6aed0c9cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 8 deletions

View File

@ -40,7 +40,7 @@ jobs:
- "bin/installDeps.sh"
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script:
- "travis_wait 15 tests/frontend/travis/runner.sh"
- "./tests/frontend/travis/runner.sh"
- name: "Run the Backend tests without Plugins"
install:
- "sudo add-apt-repository -y ppa:libreoffice/ppa"
@ -78,7 +78,7 @@ jobs:
- *install_plugins
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script:
- "travis_wait 15 tests/frontend/travis/runner.sh"
- "./tests/frontend/travis/runner.sh"
- name: "Lint test package-lock.json"
install:
- "npm install lockfile-lint"

View File

@ -40,13 +40,8 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
// 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");
printLog(logIndex);
console.log(testResult);
if (timesup) {
console.log("[" + testSettings.browserName + " " + testSettings.platform + (testSettings.version === "" ? '' : (" " + testSettings.version)) + "] \x1B[31mFAILED\x1B[39m allowed test duration exceeded");
}
@ -66,6 +61,8 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
}, 870000); // travis timeout is 15 minutes, set this to a slightly lower value
var knownConsoleText = "";
// how many characters of the log have been sent to travis
let logIndex = 0;
var getStatusInterval = setInterval(function(){
browser.eval("$('#console').text()", function(err, consoleText){
if(!consoleText || err){
@ -83,9 +80,29 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
} else {
stopSauce(false);
}
} else {
// not finished yet
printLog(logIndex);
logIndex = knownConsoleText.length;
}
});
}, 5000);
/**
* Replaces color codes in the test runners log, appends
* browser name, platform etc. to every line and prints them.
*
* @param {number} index offset from where to start
*/
function printLog(index){
let testResult = knownConsoleText.substring(index).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);
}
});
}, 6); //run 6 tests in parrallel

View File

@ -17,6 +17,7 @@ cd "${MY_DIR}/../../../"
# 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 --experimental-worker "${@}" &
ep_pid=$!
echo "Now I will try for 15 seconds to connect to Etherpad on http://localhost:9001"
@ -44,5 +45,6 @@ node remote_runner.js
exit_code=$?
kill $(cat /tmp/sauce.pid)
kill $ep_pid
exit $exit_code