Skip to content

Commit

Permalink
Do not use docker run --rm for test container to cleanup after test
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Nov 11, 2023
1 parent fcaad63 commit 265b276
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,15 @@ if [ ! "$NO_TEST" = 'true' ]; then
date
# srcds/cs2
if [ "$APPID" = 730 ]; then
CONTAINER_ID=$( docker run -itd --rm "$GAME_IMAGE" "$GAME_BIN -dedicated -port 27015 +map de_dust2" )
CONTAINER_ID=$( docker run -itd "$GAME_IMAGE" "$GAME_BIN -dedicated -port 27015 +map de_dust2" )
i=0; while [ "$i" -lt 30 ]; do
echo "Waiting for server to start"
docker logs "$CONTAINER_ID" | grep 'VAC secure mode is activated' && break || sleep 1
i=$(($i + 1))
done
docker logs "$CONTAINER_ID"
docker exec -it "$CONTAINER_ID" bash -c 'printf "\\xff\\xff\\xff\\xffTSource Engine Query\\x00" | nc -w1 -u 127.0.0.1 27015 | tr "[:cntrl:]" "\\n"' | tee "$TEST_DIR/test" \
&& docker rm -f "$CONTAINER_ID" \
|| docker rm -f "$CONTAINER_ID"
docker exec -it "$CONTAINER_ID" bash -c 'printf "\\xff\\xff\\xff\\xffTSource Engine Query\\x00" | nc -w1 -u 127.0.0.1 27015 | tr "[:cntrl:]" "\\n"' | tee "$TEST_DIR/test"
docker rm -f "$CONTAINER_ID" > /dev/null
else
time docker run -t --rm "$GAME_IMAGE" "$GAME_BIN -game $GAME +version +exit" | tee "$TEST_DIR/test"
fi
Expand Down

0 comments on commit 265b276

Please sign in to comment.