Skip to content

Commit bec37c5

Browse files
authored
Try to replace GuillaumeFalourd/assert-command-line-output action (#141)
* Try to replace GuillaumeFalourd/assert-command-line-output action * try to break test and see error * fix path * Migrate all other actions * fix path to fixture
1 parent 16b1c0f commit bec37c5

1 file changed

Lines changed: 83 additions & 45 deletions

File tree

.github/workflows/e2e-test.yml

Lines changed: 83 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ jobs:
6161
run: composer install --prefer-dist --no-progress
6262

6363
- name: Scan etherpad instance
64-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
65-
with:
66-
command_line: bin/console.php ether:scan -vvv http://localhost:8080 | grep -E "Package version|HTTP/1.1 400|Websocket" | sed 's/ *$//'
67-
assert_file_path: tests/e2e/fixture/reverse_proxy_no_websocket.txt
68-
expected_result: PASSED
64+
run: |
65+
set -euo pipefail
66+
bin/console.php ether:scan -vvv http://localhost:8080 \
67+
| grep -E "Package version|HTTP/1.1 400|Websocket" \
68+
| sed 's/ *$//' > /tmp/actual.txt
69+
70+
diff -u tests/e2e/fixture/reverse_proxy_no_websocket.txt /tmp/actual.txt
6971
7072
Etherpad2WithNginxReverseProxy:
7173
name: Docker [${{ matrix.versions.tag }}] + Nginx (no websocket)
@@ -101,11 +103,16 @@ jobs:
101103
run: composer install --prefer-dist --no-progress
102104

103105
- name: Scan etherpad instance
104-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
105-
with:
106-
command_line: bin/console.php ether:scan http://localhost:8080
107-
contains: "Package version: ${{ matrix.versions.expected }}"
108-
expected_result: PASSED
106+
run: |
107+
set -euo pipefail
108+
output="$(bin/console.php ether:scan http://localhost:8080)"
109+
echo "$output"
110+
111+
expected="Package version: ${{ matrix.versions.expected }}"
112+
if ! grep -Fq "$expected" <<< "$output"; then
113+
echo "Assertion failed: expected output to contain: $expected"
114+
exit 1
115+
fi
109116
110117
- name: Dump docker logs on failure
111118
if: failure()
@@ -142,11 +149,16 @@ jobs:
142149
run: composer install --prefer-dist --no-progress
143150

144151
- name: Scan etherpad instance
145-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
146-
with:
147-
command_line: bin/console.php ether:scan http://localhost:8080/etherpad
148-
contains: "Package version: ${{ matrix.versions.expected }}"
149-
expected_result: PASSED
152+
run: |
153+
set -euo pipefail
154+
output="$(bin/console.php ether:scan http://localhost:8080/etherpad)"
155+
echo "$output"
156+
157+
expected="Package version: ${{ matrix.versions.expected }}"
158+
if ! grep -Fq "$expected" <<< "$output"; then
159+
echo "Assertion failed: expected output to contain: $expected"
160+
exit 1
161+
fi
150162
151163
EtherpadWithNginxReverseProxyWithoutSubPath:
152164
name: Docker [1.9.7] + Nginx (without subpath)
@@ -172,11 +184,16 @@ jobs:
172184
run: composer install --prefer-dist --no-progress
173185

174186
- name: Scan etherpad instance
175-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
176-
with:
177-
command_line: bin/console.php ether:scan http://localhost:8080/test
178-
contains: "Package version: 1.9.7"
179-
expected_result: PASSED
187+
run: |
188+
set -euo pipefail
189+
output="$(bin/console.php ether:scan http://localhost:8080/test)"
190+
echo "$output"
191+
192+
expected="Package version: 1.9.7"
193+
if ! grep -Fq "$expected" <<< "$output"; then
194+
echo "Assertion failed: expected output to contain: $expected"
195+
exit 1
196+
fi
180197
181198
Etherpad17:
182199
name: Source [1.7.0]
@@ -220,11 +237,16 @@ jobs:
220237
working-directory: ./app
221238

222239
- name: Scan etherpad instance
223-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
224-
with:
225-
command_line: app/bin/console.php ether:scan http://localhost:9001
226-
contains: "Package version: 1.7.0"
227-
expected_result: PASSED
240+
run: |
241+
set -euo pipefail
242+
output="$(app/bin/console.php ether:scan http://localhost:9001)"
243+
echo "$output"
244+
245+
expected="Package version: 1.7.0"
246+
if ! grep -Fq "$expected" <<< "$output"; then
247+
echo "Assertion failed: expected output to contain: $expected"
248+
exit 1
249+
fi
228250
229251
EtherpadWithPlugins:
230252
name: Source [develop] with plugins
@@ -271,11 +293,15 @@ jobs:
271293
working-directory: ./app
272294

273295
- name: Scan etherpad instance
274-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
275-
with:
276-
command_line: app/bin/console.php ether:scan http://localhost:9001 | sed 's/ *$//' | grep -vE "(Version is|Package version)" | grep -v "Server running since" | cut -d'@' -f1
277-
assert_file_path: app/tests/e2e/fixture/master_with_plugins.txt
278-
expected_result: PASSED
296+
run: |
297+
set -euo pipefail
298+
app/bin/console.php ether:scan http://localhost:9001 \
299+
| sed 's/ *$//' \
300+
| grep -vE "(Version is|Package version)" \
301+
| grep -v "Server running since" \
302+
| cut -d'@' -f1 > /tmp/actual.txt
303+
304+
diff -u app/tests/e2e/fixture/master_with_plugins.txt /tmp/actual.txt
279305
280306
LatestEtherpad:
281307
name: Docker [latest]
@@ -309,11 +335,13 @@ jobs:
309335
cat tests/e2e/fixture/latest.txt | sed 's/$EP_VERSION/${{ needs.DynamicVersionMatrix.outputs.version }}/' > /tmp/latest.txt
310336
311337
- name: Scan etherpad instance
312-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
313-
with:
314-
command_line: bin/console.php ether:scan http://localhost:9001 | sed 's/ *$//' | grep -v "Server running since"
315-
assert_file_path: /tmp/latest.txt
316-
expected_result: PASSED
338+
run: |
339+
set -euo pipefail
340+
bin/console.php ether:scan http://localhost:9001 \
341+
| sed 's/ *$//' \
342+
| grep -v "Server running since" > /tmp/actual.txt
343+
344+
diff -u /tmp/latest.txt /tmp/actual.txt
317345
318346
EtherpadDifferentVersion:
319347
name: Docker [${{ matrix.versions.tag }}]
@@ -347,11 +375,16 @@ jobs:
347375
run: composer install --prefer-dist --no-progress
348376

349377
- name: Scan etherpad instance
350-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
351-
with:
352-
command_line: bin/console.php ether:scan http://localhost:9001
353-
contains: "Package version: ${{ matrix.versions.expected }}"
354-
expected_result: PASSED
378+
run: |
379+
set -euo pipefail
380+
output="$(bin/console.php ether:scan http://localhost:9001)"
381+
echo "$output"
382+
383+
expected="Package version: ${{ matrix.versions.expected }}"
384+
if ! grep -Fq "$expected" <<< "$output"; then
385+
echo "Assertion failed: expected output to contain: $expected"
386+
exit 1
387+
fi
355388
356389
EtherpadAdminLogin:
357390
name: Docker admin login [${{ matrix.versions.tag }}]
@@ -391,8 +424,13 @@ jobs:
391424
run: composer install --prefer-dist --no-progress
392425

393426
- name: Scan etherpad instance
394-
uses: GuillaumeFalourd/assert-command-line-output@v2.4
395-
with:
396-
command_line: bin/console.php ether:scan http://localhost:9001
397-
contains: "Admin area is accessible with admin / admin"
398-
expected_result: PASSED
427+
run: |
428+
set -euo pipefail
429+
output="$(bin/console.php ether:scan http://localhost:9001)"
430+
echo "$output"
431+
432+
expected="Admin area is accessible with admin / admin"
433+
if ! grep -Fq "$expected" <<< "$output"; then
434+
echo "Assertion failed: expected output to contain: $expected"
435+
exit 1
436+
fi

0 commit comments

Comments
 (0)