Skip to content

Commit 588d27d

Browse files
authored
use a temp directory for the emulator (#1494)
1 parent 8ab1801 commit 588d27d

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
if: ${{ always() }}
101101

102102
test-integration:
103-
name: Integration Tests
103+
name: Emulator Tests
104104
runs-on: ubuntu-20.04
105105
needs:
106106
- msrv

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,5 @@ sample/
1313
*.swp
1414
*.swo
1515
*.vim
16-
__azurite*.json
17-
__blobstorage__
18-
__queuestorage__
1916
.idea/
20-
*.iml
21-
*.bat
22-
*.ps1
2317
.env

eng/scripts/emulator_tests.sh

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,50 @@
11
#!/bin/bash
22

33
set -eux -o pipefail
4-
cd $(dirname ${BASH_SOURCE[0]})/../../
4+
BUILD=${1:-stable}
55

6+
cd $(dirname ${BASH_SOURCE[0]})/../../
67
./eng/scripts/github-disk-cleanup.sh
78

8-
BUILD=${1:-stable}
9+
# get the nested list of sub-processes for a given set of pids
10+
function subprocesses {
11+
for P in $@; do
12+
echo ${P}
13+
for C in $(pgrep -P ${P}); do
14+
subprocesses ${C}
15+
done
16+
done
17+
}
918

10-
npm install [email protected]
19+
# stop all of the subprocesses for a given set of pids
20+
function stop_subprocesses {
21+
# sort pids numerically, and in reverse
22+
PIDS=$(subprocesses $$ | sort -nr)
23+
for P in ${PIDS}; do
24+
if [ ${P} == $$ ]; then
25+
continue
26+
fi
27+
kill -9 ${P} || echo "stopping ${P} failed"
28+
done
29+
}
30+
31+
# at termination, we want to cleanup the temp directory and stop all
32+
# subprocesses (azurite)
33+
TMP=$(mktemp -d)
34+
function cleanup {
35+
stop_subprocesses || true
36+
rm -rf ${TMP} || true
37+
}
38+
trap cleanup EXIT
39+
40+
BASE_DIR=$(pwd)
41+
cd ${TMP}
42+
npm install [email protected]
1143
npx azurite &
1244

45+
# wait for azurite to start
46+
sleep 5
47+
48+
cd ${BASE_DIR}
1349
rustup update --no-self-update ${BUILD}
1450
cargo +${BUILD} test --features test_integration

0 commit comments

Comments
 (0)