Skip to content

Commit f73cb28

Browse files
authored
feat: Add tests for docker with plugins (#160)
* feat: Add tests for docker with plugins * Reduce test matrix for docker with plugins test * Update api version lookup * Show docker compose logs on failure
1 parent 7044980 commit f73cb28

5 files changed

Lines changed: 75 additions & 3 deletions

File tree

.github/workflows/e2e-test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,71 @@ jobs:
352352
353353
diff -u /tmp/latest.txt /tmp/actual.txt
354354
355+
EtherpadDockerWithPlugins:
356+
name: Docker [${{ matrix.versions.tag }}] with plugins
357+
runs-on: ubuntu-latest
358+
359+
strategy:
360+
matrix:
361+
versions: [
362+
{ tag: "2.7.2" },
363+
{ tag: "2.6.1" },
364+
{ tag: "2.5.0" },
365+
]
366+
fail-fast: false
367+
steps:
368+
- name: Checkout repository
369+
uses: actions/checkout@v6
370+
371+
- name: Start docker containers
372+
run: |
373+
EP_VERSION=${{ matrix.versions.tag }} docker compose -f ./tests/e2e/docker/docker-compose.plugins.yml up -d --wait
374+
375+
- name: Dump docker compose logs on failure
376+
if: failure()
377+
run: |
378+
docker compose -f ./tests/e2e/docker/docker-compose.plugins.yml logs --no-color --timestamps
379+
380+
- name: Cache Composer packages
381+
id: composer-cache
382+
uses: actions/cache@v5
383+
with:
384+
path: vendor
385+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
386+
restore-keys: |
387+
${{ runner.os }}-php-
388+
389+
- name: Install dependencies
390+
run: composer install --prefer-dist --no-progress
391+
392+
- name: Scan etherpad instance
393+
run: |
394+
set -euo pipefail
395+
output="$(bin/console.php ether:scan http://localhost:9001)"
396+
echo "$output"
397+
398+
expected="Package version: ${{ matrix.versions.tag }}"
399+
if ! grep -Fq "$expected" <<< "$output"; then
400+
echo "Assertion failed: expected output to contain: $expected"
401+
exit 1
402+
fi
403+
404+
expectedPackages=(
405+
"ep_align"
406+
"ep_headings2"
407+
"ep_font_color"
408+
"ep_adminpads2"
409+
"ep_comments_page"
410+
"ep_font_size"
411+
"ep_markdown"
412+
)
413+
for pkg in "${expectedPackages[@]}"; do
414+
if ! grep -Fq "* $pkg" <<< "$output"; then
415+
echo "Assertion failed: expected output to contain: * $pkg"
416+
exit 1
417+
fi
418+
done
419+
355420
EtherpadDifferentVersion:
356421
name: Docker [${{ matrix.versions.tag }}]
357422
runs-on: ubuntu-latest

src/Service/ApiVersionLookupService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class ApiVersionLookupService
2121
'1.2.13' => ['1.6.0', '1.8.0'],
2222
'1.2.14' => ['1.8.1', '1.8.5'],
2323
'1.2.15' =>['1.8.6', '1.8.18'],
24-
'1.3.0' => ['1.9.0', null],
24+
'1.3.0' => ['1.9.0', '2.7.2'],
25+
'1.3.1' => ['2.7.3', null],
2526
];
2627

2728
public function getEtherpadVersionRange(string $apiVersion): ?VersionRange
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
etherpad:
3+
image: etherpad/etherpad:$EP_VERSION
4+
command: ["sh", "-c", "pnpm run plugins i ep_align ep_headings2 ep_font_color ep_adminpads2 ep_comments_page ep_font_size ep_markdown && pnpm run prod"]
5+
ports:
6+
- 9001:9001

tests/e2e/fixture/latest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Starting scan of api: http://localhost:9001/
44

55
[INFO] No revision in server header
66

7-
[INFO] api version: 1.3.0
7+
[INFO] api version: 1.3.1
88

99
Starting scan of a pad...
1010
=========================

tests/e2e/fixture/master_with_plugins.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Starting scan of api: http://localhost:9001/
44

55
[INFO] No revision in server header
66

7-
[INFO] api version: 1.3.0
7+
[INFO] api version: 1.3.1
88

99
Starting scan of a pad...
1010
=========================

0 commit comments

Comments
 (0)