Compare commits

...

4 Commits

Author SHA1 Message Date
John McLear d80d018952 websocket is mature 2020-12-27 20:39:29 -05:00
John McLear 0e75d04a3c param for testing 2020-12-27 20:39:29 -05:00
John McLear f52dea0e13 just a demo including padid in header 2020-12-27 20:39:16 -05:00
John McLear 95e8ae1900 prolly wont work anyway 2020-12-27 20:29:57 -05:00
5 changed files with 99 additions and 3 deletions

View File

@ -74,6 +74,13 @@ jobs:
- "npm install -g etherpad-load-test"
script:
- "tests/frontend/travis/runnerLoadTest.sh"
- name: "Load test Etherpad with 3 authors but without Plugins"
install:
- "bin/installDeps.sh"
- "cd src && npm install && cd -"
- "npm install etherpad-load-test"
script:
- "tests/frontend/travis/runnerLoadTestMultiPad.sh"
# we can only frontend tests from the ether/ organization and not from forks.
# To request tests to be run ask a maintainer to fork your repo to ether/
- if: fork = false

View File

@ -448,7 +448,7 @@
/*
* Restrict socket.io transport methods
*/
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
"socketTransportProtocols" : ["websocket"],
/*
* Allow Load Testing tools to hit the Etherpad Instance.

View File

@ -219,7 +219,31 @@ const sendClientReady = (isReconnect, messageType) => {
};
const handshake = () => {
socket = pad.socket = socketio.connect(exports.baseURL, '/', {
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
// demo, needs refactor
socket = pad.socket = io({
transportOptions: {
polling: {
extraHeaders: {
'x-padId': padId
}
}
}
});
socket = pad.socket = socket.connect(url, {
handlePreflightRequest: function (req, res) {
var headers = {
'padId': "derp"
};
res.writeHead(200, headers);
res.end();
},
reconnectionAttempts: 5,
reconnection: true,
reconnectionDelay: 1000,

View File

@ -461,9 +461,23 @@
})();
// @license-end
</script>
<script>
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
padId = decodeURIComponent(padId); // unescape neccesary due to Safari and Opera interpretation of spaces
<script type="text/javascript" src="../socket.io/socket.io.js?v=<%=settings.randomVersionString%>"></script>
var url = "../socket.io/socket.io.js?padId="+padId; // needs temp version ading back in later
var script = document.createElement('script');
script.onload = function () {
//do stuff with the script
};
script.src = url;
document.head.appendChild(script); //or something of the likes
</script>
<!--
<script type="text/javascript" src="../socket.io/socket.io.js?v=<%=settings.randomVersionString%>&padId=two"></script>
-->
<!-- Include base packages manually (this help with debugging) -->
<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define&v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/ace2_common.js?callback=require.define&v=<%=settings.randomVersionString%>"></script>

View 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 across 10 pads with 3 authors"
node node_modules/etherpad-load-test/multi.js
exit_code=$?
kill $!
sleep 5
exit $exit_code