Fixed tests #172
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Proxy Test: 3 Pads <> 3 Unique Backends" | |
# any branch is useful for testing before a PR is submitted | |
on: [push, pull_request] | |
jobs: | |
deployAndLoadTest: | |
# run on pushes to any branch | |
# run on PRs from external forks | |
if: | | |
(github.event_name != 'pull_request') | |
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id) | |
name: 3 Pads <> 3 Unique Backends | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9.0.4 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: install dependencies | |
run: pnpm i | |
# install and run etherpad on ports 9001, 9002 and 9003 | |
- name: Git clone etherpad to test1 | |
uses: actions/checkout@v3 | |
with: | |
repository: ether/etherpad-lite | |
path: test1 | |
- name: prep etherpad >> test1 | |
run: cd test1/src && pnpm i | |
- name: start etherpad >> test1 | |
run: cd test1 && pnpm run prod > test1log.txt & | |
- name: Git clone etherpad to test2 | |
uses: actions/checkout@v3 | |
with: | |
repository: ether/etherpad-lite | |
path: test2 | |
- name: Change port to 9002 | |
# "port" : 9001 >> "port" :9002 | |
run: sed 's/9001/9002/g' test2/settings.json.template > test2/settings.json | |
- name: prep etherpad >> test2 | |
run: cd test2/src && pnpm i | |
- name: start etherpad >> test2 | |
run: cd test2 && pnpm run prod > test2log.txt & | |
- name: Git clone etherpad to test3 | |
uses: actions/checkout@v3 | |
with: | |
repository: ether/etherpad-lite | |
path: test3 | |
- name: Change port to 9003 | |
# "port" : 9001 >> "port" :9002 | |
run: sed 's/9001/9003/g' test2/settings.json.template > test3/settings.json | |
- name: prep etherpad >> test3 | |
run: cd test3/src && pnpm i | |
- name: start etherpad >> test3 | |
run: cd test3 && pnpm run prod > test3log.txt & | |
- name: support 1 pad per instances | |
run: sed 's/5/1/g' settings.json.template > settings.json | |
- name: check settings | |
run: cat settings.json | |
- name: Start proxy | |
run: pnpm run start > proxyLog.txt & | |
- name: Install etherpad-load-test | |
run: pnpm install etherpad-load-test -g | |
- name: wait for Etherpad | |
run: curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9003/p/test | |
- name: Load test >> test1 | |
run: etherpad-loadtest http://localhost:9000/p/test1 -d 60 & | |
- name: Sleep for 5 seconds | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '5s' | |
- name: Load test >> test2 | |
run: etherpad-loadtest http://localhost:9000/p/test2 -d 60 & | |
- name: Sleep for 5 seconds | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '5s' | |
- name: Load test >> test3 | |
run: etherpad-loadtest http://localhost:9000/p/test3 -d 60 & | |
- name: Sleep for 30 seconds | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '30s' | |
- name: proxy log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: proxy | |
path: proxyLog.txt | |
- name: test1 log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: proxy | |
path: test1/test1log.txt | |
- name: test2 log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: proxy | |
path: test2/test2log.txt | |
- name: test3 log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: proxy | |
path: test3/test3log.txt | |
- name: Test1 DB | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test1 | |
path: test1/var/dirty.db | |
- name: Test2 DB | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test2 | |
path: test2/var/dirty.db | |
- name: Test3 DB | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test3 | |
path: test3/var/dirty.db | |
- name: check test1 has just one pad. | |
run: test $(grep -oE '(test1|test2|test3)' test1/var/dirty.db | sort -u | wc -l) -eq 1 | |
- name: check test2 has just one pad. | |
run: test $(grep -oE '(test1|test2|test3)' test2/var/dirty.db | sort -u | wc -l) -eq 1 | |
- name: check test3 has just one pad. | |
run: test $(grep -oE '(test1|test2|test3)' test3/var/dirty.db | sort -u | wc -l) -eq 1 |