File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ export VIEW_ADAPTERS
1212pouchdb-setup-server () {
1313 # in CI, link pouchdb-servers dependencies on pouchdb
1414 # modules to the current implementations
15+ if [ -d " pouchdb-server-install" ]; then
16+ # pouchdb server already running
17+ exit 0
18+ fi
1519 mkdir pouchdb-server-install
1620 cd pouchdb-server-install
1721 npm init -y
@@ -54,6 +58,14 @@ pouchdb-link-server-modules() {
5458 cd ..
5559}
5660
61+ search-free-port () {
62+ EXPRESS_PORT=3000
63+ while (: < /dev/tcp/127.0.0.1/$EXPRESS_PORT ) 2> /dev/null; do
64+ (( EXPRESS_PORT++ ))
65+ done
66+ export PORT=$EXPRESS_PORT
67+ }
68+
5769pouchdb-build-node () {
5870 if [[ $BUILD_NODE_DONE -ne 1 ]]; then
5971 npm run build-node
@@ -75,9 +87,10 @@ if [[ ! -z $SERVER ]]; then
7587 fi
7688 elif [ " $SERVER " == " pouchdb-express-router" ]; then
7789 pouchdb-build-node
90+ search-free-port
7891 node ./tests/misc/pouchdb-express-router.js &
7992 export SERVER_PID=$!
80- export COUCH_HOST=' http://127.0.0.1:3000 '
93+ export COUCH_HOST=" http://127.0.0.1:${PORT} "
8194 elif [ " $SERVER " == " express-pouchdb-minimum" ]; then
8295 pouchdb-build-node
8396 node ./tests/misc/express-pouchdb-minimum-for-pouchdb.js &
Original file line number Diff line number Diff line change 1212fi
1313
1414if [ $TYPE = " integration" ]; then
15- node bin/down-server.js 3010 & export DOWN_SERVER_PID=$!
15+ if (: < /dev/tcp/127.0.0.1/3010) 2> /dev/null; then
16+ echo " down-server port already in use"
17+ else
18+ node bin/down-server.js 3010 & export DOWN_SERVER_PID=$!
19+ fi
1620
1721 TESTS_PATH=" tests/integration/test.*.js"
1822fi
You can’t perform that action at this time.
0 commit comments