mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 19:29:15 -04:00
add tests from origin/develop
This commit is contained in:
parent
6a3e4c69b8
commit
2df2d7d60a
71 changed files with 18931 additions and 4032 deletions
|
@ -17,95 +17,125 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
|
|||
testSettings.name = name;
|
||||
testSettings["public"] = true;
|
||||
testSettings["build"] = process.env.GIT_HASH;
|
||||
testSettings["extendedDebugging"] = true; // console.json can be downloaded via saucelabs, don't know how to print them into output of the tests
|
||||
testSettings["tunnelIdentifier"] = process.env.TRAVIS_JOB_NUMBER;
|
||||
|
||||
browser.init(testSettings).get("http://localhost:9001/tests/frontend/", function(){
|
||||
var url = "https://saucelabs.com/jobs/" + browser.sessionID;
|
||||
console.log("Remote sauce test '" + name + "' started! " + url);
|
||||
browser.init(testSettings).get("http://localhost:9001/tests/frontend/", function(){
|
||||
var url = "https://saucelabs.com/jobs/" + browser.sessionID;
|
||||
console.log("Remote sauce test '" + name + "' started! " + url);
|
||||
|
||||
//tear down the test excecution
|
||||
var stopSauce = function(success){
|
||||
getStatusInterval && clearInterval(getStatusInterval);
|
||||
clearTimeout(timeout);
|
||||
//tear down the test excecution
|
||||
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");
|
||||
|
||||
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);
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
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.version === "" ? '' : (" " + testSettings.version)) + "] " + line;
|
||||
}).join("\n");
|
||||
/**
|
||||
* 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,true);
|
||||
}, 570000); // travis timeout is 10 minutes, set this to a slightly lower value
|
||||
|
||||
console.log(testResult);
|
||||
console.log("Remote sauce test '" + name + "' finished! " + url);
|
||||
var knownConsoleText = "";
|
||||
var getStatusInterval = setInterval(function(){
|
||||
browser.eval("$('#console').text()", function(err, consoleText){
|
||||
if(!consoleText || err){
|
||||
return;
|
||||
}
|
||||
knownConsoleText = consoleText;
|
||||
|
||||
callback();
|
||||
}
|
||||
if(knownConsoleText.indexOf("FINISHED") > 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);
|
||||
|
||||
//timeout for the case the test hangs
|
||||
var timeout = setTimeout(function(){
|
||||
stopSauce(false);
|
||||
}, 60000 * 10);
|
||||
// finished but some tests did not return or some tests failed
|
||||
} else {
|
||||
stopSauce(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
var knownConsoleText = "";
|
||||
var getStatusInterval = setInterval(function(){
|
||||
browser.eval("$('#console').text()", function(err, consoleText){
|
||||
if(!consoleText || err){
|
||||
return;
|
||||
}
|
||||
knownConsoleText = consoleText;
|
||||
}, 6); //run 6 tests in parrallel
|
||||
|
||||
if(knownConsoleText.indexOf("FINISHED") > 0){
|
||||
var success = knownConsoleText.indexOf("FAILED") === -1;
|
||||
stopSauce(success);
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
}, 5); //run 5 tests in parrallel
|
||||
|
||||
// Firefox
|
||||
// 1) Firefox on Linux
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Linux'
|
||||
'platform' : 'Windows 7'
|
||||
, 'browserName' : 'firefox'
|
||||
, 'version' : ''
|
||||
, 'version' : '52.0'
|
||||
});
|
||||
|
||||
// Chrome
|
||||
// 2) Chrome on Linux
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Linux'
|
||||
, 'browserName' : 'googlechrome'
|
||||
, 'version' : ''
|
||||
'platform' : 'Windows 7'
|
||||
, 'browserName' : 'chrome'
|
||||
, 'version' : '55.0'
|
||||
, 'args' : ['--use-fake-device-for-media-stream']
|
||||
});
|
||||
|
||||
// 3) Safari on OSX 10.15
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'OS X 10.15'
|
||||
, 'browserName' : 'safari'
|
||||
, 'version' : '13.1'
|
||||
});
|
||||
|
||||
// 4) Safari on OSX 10.14
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'OS X 10.14'
|
||||
, 'browserName' : 'safari'
|
||||
, 'version' : '12.0'
|
||||
});
|
||||
// IE 10 doesn't appear to be working anyway
|
||||
/*
|
||||
// IE 8
|
||||
// 4) IE 10 on Win 8
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2003'
|
||||
'platform' : 'Windows 8'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '8'
|
||||
, 'version' : '10.0'
|
||||
});
|
||||
*/
|
||||
|
||||
// IE 9
|
||||
// 5) Edge on Win 10
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows XP'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '9'
|
||||
'platform' : 'Windows 10'
|
||||
, 'browserName' : 'microsoftedge'
|
||||
, 'version' : '83.0'
|
||||
});
|
||||
// 6) Firefox on Win 7
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 7'
|
||||
, 'browserName' : 'firefox'
|
||||
, 'version' : '78.0'
|
||||
});
|
||||
|
||||
// IE 10
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2012'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '10'
|
||||
sauceTestWorker.drain(function() {
|
||||
process.exit(allTestsPassed ? 0 : 1);
|
||||
});
|
||||
|
||||
sauceTestWorker.drain = function() {
|
||||
setTimeout(function(){
|
||||
process.exit(allTestsPassed ? 0 : 1);
|
||||
}, 3000);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,48 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
if [ -z "${SAUCE_USERNAME}" ]; then echo "SAUCE_USERNAME is unset - exiting"; exit 1; fi
|
||||
if [ -z "${SAUCE_ACCESS_KEY}" ]; then echo "SAUCE_ACCESS_KEY is unset - exiting"; exit 1; fi
|
||||
|
||||
#Move to the base folder
|
||||
cd `dirname $0`
|
||||
# do not continue if there is an error
|
||||
set -eu
|
||||
|
||||
#start Etherpad
|
||||
../../../bin/run.sh > /dev/null &
|
||||
sleep 10
|
||||
# source: https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself#246128
|
||||
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
#start remote runner
|
||||
# reliably move to the etherpad base folder before running it
|
||||
cd "${MY_DIR}/../../../"
|
||||
|
||||
# start Etherpad, assuming all dependencies are already installed.
|
||||
#
|
||||
# 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 "${@}" &
|
||||
|
||||
echo "Now I will try for 15 seconds to connect to Etherpad on http://localhost:9001"
|
||||
|
||||
# wait for at most 15 seconds until Etherpad starts accepting connections
|
||||
#
|
||||
# modified from:
|
||||
# https://unix.stackexchange.com/questions/5277/how-do-i-tell-a-script-to-wait-for-a-process-to-start-accepting-requests-on-a-po#349138
|
||||
#
|
||||
(timeout 15 bash -c 'until echo > /dev/tcp/localhost/9001; do sleep 0.5; done') || \
|
||||
(echo "Could not connect to Etherpad on http://localhost:9001" ; exit 1)
|
||||
|
||||
echo "Successfully connected to Etherpad on http://localhost:9001"
|
||||
|
||||
# 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.
|
||||
# Let's move back there.
|
||||
#
|
||||
# Probably remote_runner.js is injected by Saucelabs.
|
||||
cd "${MY_DIR}"
|
||||
|
||||
# start the remote runner
|
||||
echo "Now starting the remote runner"
|
||||
node remote_runner.js
|
||||
exit_code=$?
|
||||
|
||||
kill $!
|
||||
kill $(cat /tmp/sauce.pid)
|
||||
sleep 30
|
||||
|
||||
exit $exit_code
|
||||
exit $exit_code
|
||||
|
|
51
tests/frontend/travis/runnerBackend.sh
Executable file
51
tests/frontend/travis/runnerBackend.sh
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
# do not continue if there is an error
|
||||
set -u
|
||||
|
||||
# source: https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself#246128
|
||||
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
# reliably move to the etherpad base folder before running it
|
||||
cd "${MY_DIR}/../../../"
|
||||
|
||||
# Set soffice to /usr/bin/soffice
|
||||
sed 's#\"soffice\": null,#\"soffice\":\"/usr/bin/soffice\",#g' settings.json.template > settings.json.soffice
|
||||
|
||||
# Set allowAnyoneToImport to true
|
||||
sed 's/\"allowAnyoneToImport\": false,/\"allowAnyoneToImport\": true,/g' settings.json.soffice > settings.json.allowImport
|
||||
|
||||
# Set "max": 10 to 100 to not agressively rate limit
|
||||
sed 's/\"max\": 10/\"max\": 100/g' settings.json.allowImport > settings.json.rateLimit
|
||||
|
||||
# Set "points": 10 to 1000 to not agressively rate limit commits
|
||||
sed 's/\"points\": 10/\"points\": 1000/g' settings.json.rateLimit > settings.json
|
||||
|
||||
# start Etherpad, assuming all dependencies are already installed.
|
||||
#
|
||||
# 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 &
|
||||
|
||||
echo "Now I will try for 15 seconds to connect to Etherpad on http://localhost:9001"
|
||||
|
||||
# wait for at most 15 seconds until Etherpad starts accepting connections
|
||||
#
|
||||
# modified from:
|
||||
# https://unix.stackexchange.com/questions/5277/how-do-i-tell-a-script-to-wait-for-a-process-to-start-accepting-requests-on-a-po#349138
|
||||
#
|
||||
(timeout 15 bash -c 'until echo > /dev/tcp/localhost/9001; do sleep 0.5; done') || \
|
||||
(echo "Could not connect to Etherpad on http://localhost:9001" ; exit 1)
|
||||
|
||||
echo "Successfully connected to Etherpad on http://localhost:9001"
|
||||
|
||||
# run the backend tests
|
||||
echo "Now run the backend tests"
|
||||
cd src
|
||||
|
||||
failed=0
|
||||
npm run test || failed=1
|
||||
npm run test-contentcollector || failed=1
|
||||
|
||||
exit $failed
|
51
tests/frontend/travis/runnerLoadTest.sh
Executable file
51
tests/frontend/travis/runnerLoadTest.sh
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
# do not continue if there is an error
|
||||
set -eu
|
||||
|
||||
# source: https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself#246128
|
||||
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
# reliably move to the etherpad base folder before running it
|
||||
cd "${MY_DIR}/../../../"
|
||||
|
||||
# Set "points": 10 to 1000 to not agressively rate limit commits
|
||||
sed 's/\"points\": 10/\"points\": 1000/g' settings.json.template > settings.json.points
|
||||
# And enable loadTest
|
||||
sed 's/\"loadTest\": false,/\"loadTest\": true,/g' settings.json.points > settings.json
|
||||
|
||||
# start Etherpad, assuming all dependencies are already installed.
|
||||
#
|
||||
# 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 &
|
||||
|
||||
echo "Now I will try for 15 seconds to connect to Etherpad on http://localhost:9001"
|
||||
|
||||
# wait for at most 15 seconds until Etherpad starts accepting connections
|
||||
#
|
||||
# modified from:
|
||||
# https://unix.stackexchange.com/questions/5277/how-do-i-tell-a-script-to-wait-for-a-process-to-start-accepting-requests-on-a-po#349138
|
||||
#
|
||||
(timeout 15 bash -c 'until echo > /dev/tcp/localhost/9001; do sleep 0.5; done') || \
|
||||
(echo "Could not connect to Etherpad on http://localhost:9001" ; exit 1)
|
||||
|
||||
echo "Successfully connected to Etherpad on http://localhost:9001"
|
||||
|
||||
# Build the minified files?
|
||||
curl http://localhost:9001/p/minifyme -f -s > /dev/null
|
||||
|
||||
# just in case, let's wait for another 10 seconds before going on
|
||||
sleep 10
|
||||
|
||||
# run the backend tests
|
||||
echo "Now run the load tests for 30 seconds and if it stalls before 100 then error"
|
||||
etherpad-loadtest -d 30
|
||||
exit_code=$?
|
||||
|
||||
kill $!
|
||||
sleep 5
|
||||
|
||||
exit $exit_code
|
|
@ -1,11 +1,20 @@
|
|||
#!/bin/bash
|
||||
# download and unzip the sauce connector
|
||||
curl https://saucelabs.com/downloads/sc-latest-linux.tar.gz > /tmp/sauce.tar.gz
|
||||
#
|
||||
# ACHTUNG: as of 2019-12-21, downloading sc-latest-linux.tar.gz does not work.
|
||||
# It is necessary to explicitly download a specific version, for
|
||||
# example https://saucelabs.com/downloads/sc-4.5.4-linux.tar.gz
|
||||
# Supported versions are currently listed at:
|
||||
# https://wiki.saucelabs.com/display/DOCS/Downloading+Sauce+Connect+Proxy
|
||||
if [ -z "${SAUCE_USERNAME}" ]; then echo "SAUCE_USERNAME is unset - exiting"; exit 1; fi
|
||||
if [ -z "${SAUCE_ACCESS_KEY}" ]; then echo "SAUCE_ACCESS_KEY is unset - exiting"; exit 1; fi
|
||||
|
||||
curl https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz > /tmp/sauce.tar.gz
|
||||
tar zxf /tmp/sauce.tar.gz --directory /tmp
|
||||
mv /tmp/sc-*-linux /tmp/sauce_connect
|
||||
|
||||
# start the sauce connector in background and make sure it doesn't output the secret key
|
||||
(/tmp/sauce_connect/bin/sc --user $SAUCE_USERNAME --key $SAUCE_ACCESS_KEY --pidfile /tmp/sauce.pid --readyfile /tmp/tunnel > /dev/null )&
|
||||
(/tmp/sauce_connect/bin/sc --user "${SAUCE_USERNAME}" --key "${SAUCE_ACCESS_KEY}" -i "${TRAVIS_JOB_NUMBER}" --pidfile /tmp/sauce.pid --readyfile /tmp/tunnel > /dev/null )&
|
||||
|
||||
# wait for the tunnel to build up
|
||||
while [ ! -e "/tmp/tunnel" ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue