Skip to content

Commit 259a66f

Browse files
UTAPI-116: Collect stderr and check for logs
1 parent c3c00db commit 259a66f

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/scripts/run_ft_tests.bash

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ if [ -z "$SETUP_CMD" ]; then
1717
SETUP_CMD="start"
1818
fi
1919

20-
UTAPI_INTERVAL_TEST_MODE=$1 npm $SETUP_CMD 2>&1 | tee -a "setup_$2.log" &
20+
# Redirect stderr to a separate file (without "Killed" to look for warnings / error messages)
21+
# While still keeping it in terminal
22+
23+
UTAPI_INTERVAL_TEST_MODE=$1 npm $SETUP_CMD \
24+
2> >(grep -v -E "^Killed$" | tee -a "setup_$2.stderr.log" >&2) \
25+
| tee -a "setup_$2.log" &
26+
2127
bash tests/utils/wait_for_local_port.bash $PORT 40
22-
UTAPI_INTERVAL_TEST_MODE=$1 npm run $2 | tee -a "test_$2.log"
28+
29+
UTAPI_INTERVAL_TEST_MODE=$1 npm run $2 \
30+
2> >(tee -a "test_$2.stderr.log" >&2) \
31+
| tee -a "test_$2.log"

.github/workflows/tests.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ jobs:
141141
- name: ${{ matrix.test.name }}
142142
run: ${{ matrix.test.command }}
143143
env: ${{ matrix.test.env }}
144+
- name: Print stderr logs
145+
run: grep -v "" *.stderr.log || true
146+
- name: Error if stderr logs are not empty
147+
run: if [ -n "$(find . -name '*.stderr.log' -size +0c)" ]; then exit 1; fi
144148

145149
tests-v2-with-vault:
146150
needs:
@@ -246,6 +250,12 @@ jobs:
246250
tmate-server-rsa-fingerprint: ${{ secrets.TMATE_SERVER_RSA_FINGERPRINT }}
247251
tmate-server-ed25519-fingerprint: ${{ secrets.TMATE_SERVER_ED25519_FINGERPRINT }}
248252
if: ${{ ( github.event.inputs.debug == true || github.event.inputs.debug == 'true' ) }}
253+
- name: Print stderr logs
254+
run: grep -v "" *.stderr.log || true
255+
- name: Error if stderr logs are not empty
256+
run: if [ -n "$(find . -name '*.stderr.log' -size +0c)" ]; then exit 1; fi
257+
258+
249259
tests-v2-without-sensision:
250260
needs:
251261
- build-ci
@@ -362,3 +372,7 @@ jobs:
362372
tmate-server-rsa-fingerprint: ${{ secrets.TMATE_SERVER_RSA_FINGERPRINT }}
363373
tmate-server-ed25519-fingerprint: ${{ secrets.TMATE_SERVER_ED25519_FINGERPRINT }}
364374
if: ${{ ( github.event.inputs.debug == true || github.event.inputs.debug == 'true' ) }}
375+
- name: Print stderr logs
376+
run: grep -v "" *.stderr.log || true
377+
- name: Error if stderr logs are not empty
378+
run: if [ -n "$(find . -name '*.stderr.log' -size +0c)" ]; then exit 1; fi

0 commit comments

Comments
 (0)