Skip to content

Commit 4b1d0d9

Browse files
committed
add single bash to run tests for node 14,16,18
1 parent ccf6198 commit 4b1d0d9

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
"local-proxy": "node ./dist/run_locally.js",
4040
"test": "nyc cross-env NODE_OPTIONS=--insecure-http-parser mocha",
4141
"test:docker": "docker build --tag proxy-chain-tests --file test/Dockerfile . && docker run proxy-chain-tests",
42-
"test:docker:node18": "docker build --build-arg NODE_IMAGE=node:18.20.8-bookworm --tag proxy-chain-tests:node18 --file test/Dockerfile . && docker run proxy-chain-tests:node18",
43-
"test:docker:node16": "docker build --build-arg NODE_IMAGE=node:16.20.2-bookworm --tag proxy-chain-tests:node16 --file test/Dockerfile . && docker run proxy-chain-tests:node16",
44-
"test:docker:node14": "docker build --build-arg NODE_IMAGE=node:14.21.3-bullseye --tag proxy-chain-tests:node14 --file test/Dockerfile . && docker run proxy-chain-tests:node14",
42+
"test:docker:all": "bash scripts/test-docker-all.sh",
4543
"lint": "eslint .",
4644
"lint:fix": "eslint . --fix"
4745
},

scripts/test-docker-all.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
echo "Starting parallel Docker tests for Node 14, 16, and 18..."
4+
5+
# Run builds in parallel, capture PIDs.
6+
docker build --build-arg NODE_IMAGE=node:14.21.3-bullseye --tag proxy-chain-tests:node14 --file test/Dockerfile . && docker run proxy-chain-tests:node14 &
7+
pid14=$!
8+
docker build --build-arg NODE_IMAGE=node:16.20.2-bookworm --tag proxy-chain-tests:node16 --file test/Dockerfile . && docker run proxy-chain-tests:node16 &
9+
pid16=$!
10+
docker build --build-arg NODE_IMAGE=node:18.20.8-bookworm --tag proxy-chain-tests:node18 --file test/Dockerfile . && docker run proxy-chain-tests:node18 &
11+
pid18=$!
12+
13+
# Wait for all and capture exit codes.
14+
wait $pid14
15+
ec14=$?
16+
wait $pid16
17+
ec16=$?
18+
wait $pid18
19+
ec18=$?
20+
21+
echo ""
22+
echo "========== Results =========="
23+
echo "Node 14: $([ $ec14 -eq 0 ] && echo 'PASS' || echo 'FAIL')"
24+
echo "Node 16: $([ $ec16 -eq 0 ] && echo 'PASS' || echo 'FAIL')"
25+
echo "Node 18: $([ $ec18 -eq 0 ] && echo 'PASS' || echo 'FAIL')"
26+
echo "============================="
27+
28+
# Exit with non-zero if any failed.
29+
exit $((ec14 + ec16 + ec18))

0 commit comments

Comments
 (0)