Skip to content

Commit 108cf72

Browse files
IvanHuntersmyasnikovdaniil
authored andcommitted
test(e2e): drop bash-only RETURN trap from bucket.bats port-forward
The previous attempt added a bash `trap '...' RETURN` to clean up kubectl port-forward when the test function returned. cozytest.sh sources its converted bats test bodies into the runner shell, which on the GitHub-hosted Linux runner is /bin/sh -> dash. dash does not implement the bash-specific RETURN pseudo-signal, so the trap command exits non-zero, the surrounding `set -eu` aborts the test body immediately, and the captured output stops two lines after `name=test` with no other diagnostic — the test never reaches the mc S3 operations at all. Drop the trap and rely on cozytest.sh's existing process-group cleanup: when the test function returns, the leftover port-forward job in the same group is terminated. This restores POSIX shell compatibility while keeping the lifecycle fix from the previous commit (no `bash -c '... &'` wrapper, port-forward stays alive through the mc operations because it is a child of the calling shell, not of a transient subshell that exits immediately). Signed-off-by: Ivan Okhotnikov <[email protected]>
1 parent 86739a9 commit 108cf72

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎hack/e2e-apps/bucket.bats‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ EOF
4242
# wrapper subshell exits immediately, the backgrounded kubectl becomes an
4343
# orphan and gets reaped before the first mc S3 request, so `mc cp` sees
4444
# `dial tcp 127.0.0.1:8333: connect: connection refused` even though the
45-
# earlier `nc -z` probe succeeded.
45+
# earlier `nc -z` probe succeeded). The forked port-forward inherits the
46+
# test process group; cozytest.sh kills the whole group when the test
47+
# function returns, so no explicit cleanup is needed.
4648
kubectl port-forward service/seaweedfs-s3 -n tenant-root 8333:8333 >/dev/null 2>&1 &
47-
PORT_FORWARD_PID=$!
48-
trap 'kill ${PORT_FORWARD_PID} 2>/dev/null || true' RETURN
4949

5050
# Wait for port-forward to be ready
5151
timeout 30 sh -ec 'until nc -z 127.0.0.1 8333; do sleep 1; done'

0 commit comments

Comments
 (0)