Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions system-test/Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM golang:1.12-stretch as builder
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /root/
RUN go get github.com/google/pprof

FROM debian:stretch

RUN apt-get update && apt-get install -y \
curl \
python \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*

ENV NVM_DIR /root/.nvm
RUN mkdir -p $NVM_DIR

ARG NODE_VERSION
ARG NVM_NODEJS_ORG_MIRROR

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

ENV BASH_ENV /root/.bashrc

WORKDIR /root/
COPY --from=0 /go/bin/pprof /bin
10 changes: 10 additions & 0 deletions system-test/Dockerfile.node10-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.12-alpine as builder
RUN apk update && apk upgrade && apk add --no-cache git
WORKDIR /root/
RUN go get github.com/google/pprof

FROM node:10-alpine
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
WORKDIR /root/
COPY --from=0 /go/bin/pprof /bin
RUN chmod a+x /bin/pprof
10 changes: 10 additions & 0 deletions system-test/Dockerfile.node11-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.12-alpine as builder
RUN apk update && apk upgrade && apk add --no-cache git
WORKDIR /root/
RUN go get github.com/google/pprof

FROM node:11-alpine
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
WORKDIR /root/
COPY --from=0 /go/bin/pprof /bin
RUN chmod a+x /bin/pprof
10 changes: 10 additions & 0 deletions system-test/Dockerfile.node6-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.12-alpine as builder
RUN apk update && apk upgrade && apk add --no-cache git
WORKDIR /root/
RUN go get github.com/google/pprof

FROM node:6-alpine
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
WORKDIR /root/
COPY --from=0 /go/bin/pprof /bin
RUN chmod a+x /bin/pprof
10 changes: 10 additions & 0 deletions system-test/Dockerfile.node8-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.12-alpine as builder
RUN apk update && apk upgrade && apk add --no-cache git
WORKDIR /root/
RUN go get github.com/google/pprof

FROM node:8-alpine
RUN apk update && apk upgrade && apk add --no-cache bash python g++ make
WORKDIR /root/
COPY --from=0 /go/bin/pprof /bin
RUN chmod a+x /bin/pprof
232 changes: 0 additions & 232 deletions system-test/system_test.go

This file was deleted.

48 changes: 17 additions & 31 deletions system-test/system_test.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
#!/bin/bash

retry() {
for i in {1..3}; do
"${@}" && return 0
done
return 1
}

# Fail on any error.
set -eo pipefail

# Display commands being run.
set -x
# Trap all errors.
trap "echo '** AT LEAST ONE OF TESTS FAILED **'" ERR

# Record directory of pprof-nodejs.
cd $(dirname $0)/..
BASE_DIR=$(pwd)
# Fail on any error, show commands run.
set -eox pipefail

RUN_ONLY_V8_CANARY_TEST="${RUN_ONLY_V8_CANARY_TEST:-false}"
echo "$RUN_ONLY_V8_CANARY_TEST"

# Install nvm.
retry curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash &>/dev/null
export NVM_DIR="$HOME/.nvm" &>/dev/null
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &>/dev/null
retry() {
"${@}" || "${@}" || "${@}" || exit $?
}

# Move system test to separate directory to run.
TESTDIR="$BASE_DIR/run-system-test"
cp -R "system-test" "$TESTDIR"
cd $(dirname $0)

# Run test.
cd "$TESTDIR"
retry go get -t -d .
go test -v -timeout=10m -run TestAgentIntegration -pprof_nodejs_path="$BASE_DIR" -run_only_v8_canary_test="$RUN_ONLY_V8_CANARY_TEST" -binary_host="$BINARY_HOST"
for i in 6 8 10 11; do
# Test Linux support for the given node version.
retry docker build -f Dockerfile.linux --build-arg NODE_VERSION=$i -t node$i-linux .
docker run -v $PWD/..:/src node$i-linux /src/system-test/test.sh
# Test Alpine support for the given node version.
docker build -f Dockerfile.node$i-alpine -t node$i-alpine .
docker run -v $PWD/..:/src node$i-alpine /src/system-test/test.sh
done

# Remove directory where test was run.
rm -r $TESTDIR
echo '** ALL TESTS PASSED **'
Loading