File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed
Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 77# Using the `Dockerfile.template` in the root directory now.
88Dockerfile
99
10+ # Sigh, some `run.sh` scripts do use `npm i`.
11+ node_modules
12+ package.json
13+ package-lock.json
14+
1015# To make sure all `lib` directories are effectively symlinks to `$REPO_ROOT/lib`.
1116# Unless they are explicit copies, since otherwise Docker-based builds would not succeed.
1217step * /code /src /lib
Original file line number Diff line number Diff line change @@ -12,9 +12,20 @@ set -e
1212[ -L code/templates ] && (unlink code/templates && echo ' Symlink of `code/templates` removed.' ) || echo ' No `code/templates` symlink to remove.'
1313[ -d code/templates ] && echo ' The `code/templates` dir exists, using it.' || (cp -r ../lib/templates code/ && echo ' Copied `../lib/templates` into `code/templates`.' )
1414
15+ echo ' `npm i ws`.'
16+ npm i ws
17+ echo ' `npm i ws`: success.'
18+
1519docker build -f ../Dockerfile.template . -t demo
1620
17- docker run --rm --network=bridge -p 3000:3000 -t demo &
21+ function cleanup {
22+ echo -n " trap: stopping the docker container "
23+ docker stop -t 0 rust_experiments_docker_container
24+ echo " docker stop done"
25+ }
26+ trap cleanup EXIT
27+
28+ docker run --rm --name rust_experiments_docker_container --network=bridge -p 3000:3000 -t demo &
1829PID=$!
1930
2031while true ; do
@@ -27,17 +38,18 @@ while true ; do
2738 echo " server not yet healthy"
2839done
2940
30- S=" $( npx wscat -c ws://0.0.0.0:3000/test_ws | head -n 1) "
41+ WS_NODEJS_CODE=" const WS = require('ws'); (new WS('ws://localhost:3000/test_ws')).on('message', buf => console.log(buf.toString()));"
42+
43+ S=" $( node -e " $WS_NODEJS_CODE " | head -n 1) "
3144G=" magic"
3245
3346if [ " $S " != " $G " ] ; then
3447 echo " TEST FAILED, expected '$G ', seeing '$S '."
48+ exit 1
3549fi
3650
3751curl -s localhost:3000/quit
3852
39- wait $PID
53+ trap - EXIT
4054
41- if [ " $S " = " $G " ] ; then
42- exit 1
43- fi
55+ wait $PID
You can’t perform that action at this time.
0 commit comments