Skip to content

Commit 1cc1b6c

Browse files
nolanmar511aalexand
authored andcommitted
chore: add back downloading pre-built binaries in system tests (#24)
chore: add back downloading pre-built binaries to system tests
1 parent a8adeba commit 1cc1b6c

File tree

15 files changed

+77
-36
lines changed

15 files changed

+77
-36
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.nyc_output
22
.coverage
33
.vscode
4-
build
4+
/*.build
55
out
66
node_modules
77
system-test/busybench/package-lock.json

system-test/Dockerfile.linux

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ RUN go get github.com/google/pprof
77

88
FROM debian:stretch
99

10-
RUN apt-get update && apt-get install -y \
11-
curl \
12-
python \
13-
make \
14-
g++ \
15-
&& rm -rf /var/lib/apt/lists/*
10+
ARG NODE_VERSION
11+
ARG NVM_NODEJS_ORG_MIRROR
12+
ARG ADDITIONAL_PACKAGES
13+
14+
RUN apt-get update && apt-get install -y curl $ADDITIONAL_PACKAGES \
15+
&& rm -rf /var/lib/apt/lists/*
1616

1717
ENV NVM_DIR /root/.nvm
1818
RUN mkdir -p $NVM_DIR
1919

20-
ARG NODE_VERSION
21-
ARG NVM_NODEJS_ORG_MIRROR
2220

2321
# Install nvm with node and npm
2422
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash \

system-test/Dockerfile.node10-alpine

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ RUN apk update && apk upgrade && apk add --no-cache git
33
WORKDIR /root/
44
RUN go get github.com/google/pprof
55

6+
67
FROM node:10-alpine
7-
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
8+
9+
ARG ADDITIONAL_PACKAGES
10+
11+
RUN apk update && apk upgrade && apk add --no-cache bash $ADDITIONAL_PACKAGES
812
WORKDIR /root/
913
COPY --from=0 /go/bin/pprof /bin
1014
RUN chmod a+x /bin/pprof

system-test/Dockerfile.node11-alpine

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ RUN apk update && apk upgrade && apk add --no-cache git
33
WORKDIR /root/
44
RUN go get github.com/google/pprof
55

6+
67
FROM node:11-alpine
7-
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
8+
9+
ARG ADDITIONAL_PACKAGES
10+
11+
RUN apk update && apk upgrade && apk add --no-cache bash $ADDITIONAL_PACKAGES
812
WORKDIR /root/
913
COPY --from=0 /go/bin/pprof /bin
1014
RUN chmod a+x /bin/pprof

system-test/Dockerfile.node6-alpine

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ RUN apk update && apk upgrade && apk add --no-cache git
33
WORKDIR /root/
44
RUN go get github.com/google/pprof
55

6+
67
FROM node:6-alpine
7-
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
8+
9+
ARG ADDITIONAL_PACKAGES
10+
11+
RUN apk update && apk upgrade && apk add --no-cache bash $ADDITIONAL_PACKAGES
812
WORKDIR /root/
913
COPY --from=0 /go/bin/pprof /bin
1014
RUN chmod a+x /bin/pprof

system-test/Dockerfile.node8-alpine

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ RUN apk update && apk upgrade && apk add --no-cache git
33
WORKDIR /root/
44
RUN go get github.com/google/pprof
55

6+
67
FROM node:8-alpine
7-
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
8+
9+
ARG ADDITIONAL_PACKAGES
10+
11+
RUN apk update && apk upgrade && apk add --no-cache bash $ADDITIONAL_PACKAGES
812
WORKDIR /root/
913
COPY --from=0 /go/bin/pprof /bin
1014
RUN chmod a+x /bin/pprof

system-test/system_test.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ retry() {
1212

1313
cd $(dirname $0)
1414

15+
if [[ -z "$BINARY_HOST" ]]; then
16+
ADDITIONAL_PACKAGES="python g++ make"
17+
fi
18+
1519
for i in 6 8 10 11; do
1620
# Test Linux support for the given node version.
17-
retry docker build -f Dockerfile.linux --build-arg NODE_VERSION=$i -t node$i-linux .
18-
docker run -v $PWD/..:/src node$i-linux /src/system-test/test.sh
21+
retry docker build -f Dockerfile.linux --build-arg NODE_VERSION=$i \
22+
--build-arg ADDITIONAL_PACKAGES="$ADDITIONAL_PACKAGES" -t node$i-linux .
23+
24+
docker run -v $PWD/..:/src -e BINARY_HOST="$BINARY_HOST" node$i-linux \
25+
/src/system-test/test.sh
26+
1927
# Test Alpine support for the given node version.
20-
docker build -f Dockerfile.node$i-alpine -t node$i-alpine .
21-
docker run -v $PWD/..:/src node$i-alpine /src/system-test/test.sh
28+
retry docker build -f Dockerfile.node$i-alpine \
29+
--build-arg ADDITIONAL_PACKAGES="$ADDITIONAL_PACKAGES" -t node$i-alpine .
30+
31+
docker run -v $PWD/..:/src -e BINARY_HOST="$BINARY_HOST" node$i-alpine \
32+
/src/system-test/test.sh
2233
done
2334

2435
echo '** ALL TESTS PASSED **'

system-test/test.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ NODEDIR=$(dirname $(dirname $(which node)))
1515
# For v8-canary tests, we need to use the version of NAN on github, which
1616
# contains unreleased fixes that allow the native component to be compiled
1717
# with Node's V8 canary build.
18-
[ -z $NVM_NODEJS_ORG_MIRROR ] || retry npm install https://github.com/nodejs/nan.git
18+
[ -z $NVM_NODEJS_ORG_MIRROR ] \
19+
|| retry npm install https://github.com/nodejs/nan.git
1920

20-
retry npm install --nodedir="$NODEDIR" >/dev/null
21+
retry npm install --nodedir="$NODEDIR" \
22+
${BINARY_HOST:+--pprof_binary_host_mirror=$BINARY_HOST} >/dev/null
2123

2224
npm run compile
2325
npm pack >/dev/null
@@ -29,14 +31,18 @@ cp -r "$PWD/system-test/busybench" "$TESTDIR"
2931
cd "$TESTDIR/busybench"
3032

3133
retry npm install pify @types/pify typescript gts @types/node >/dev/null
32-
retry npm install --nodedir="$NODEDIR" "$PROFILER" >/dev/null
34+
retry npm install --nodedir="$NODEDIR" \
35+
${BINARY_HOST:+--pprof_binary_host_mirror=$BINARY_HOST} \
36+
"$PROFILER" >/dev/null
3337

3438
npm run compile >/dev/null
3539

3640
node -v
3741
node --trace-warnings build/src/busybench.js 10
3842
ls -l
3943

40-
pprof -filefunctions -top -nodecount=2 time.pb.gz | grep "busyLoop.*build/src/busybench.js"
41-
pprof -filefunctions -top -nodecount=2 heap.pb.gz | grep "busyLoop.*build/src/busybench.js"
44+
pprof -filefunctions -top -nodecount=2 time.pb.gz | \
45+
grep "busyLoop.*build/src/busybench.js"
46+
pprof -filefunctions -top -nodecount=2 heap.pb.gz | \
47+
grep "busyLoop.*build/src/busybench.js"
4248
echo '** TEST PASSED **'

tools/build/Dockerfile.alpine

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM node:10-alpine
2+
RUN apk add --no-cache python curl bash python g++ make
File renamed without changes.

0 commit comments

Comments
 (0)