diff --git a/Dockerfile.test b/Dockerfile.node6.test similarity index 100% rename from Dockerfile.test rename to Dockerfile.node6.test diff --git a/Dockerfile.node8.test b/Dockerfile.node8.test new file mode 100644 index 0000000..f8c3f76 --- /dev/null +++ b/Dockerfile.node8.test @@ -0,0 +1,29 @@ +FROM resin/intel-nuc-node:8 + +VOLUME /var/lib/docker + +RUN apt-get update \ + && apt-get install -y aufs-tools rsync iptables \ + && rm -rf /var/lib/apt/lists/* + +ENV DOCKER_VERSION 1.11.2 +RUN wget -q -O /tmp/docker-${DOCKER_VERSION}.tgz https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz \ + && tar xvfz /tmp/docker-${DOCKER_VERSION}.tgz -C /tmp \ + && cp -r /tmp/docker/* /usr/bin/ \ + && rm -rf /tmp/docker \ + && chmod +x /usr/bin/docker* + +WORKDIR /usr/src/app + +COPY package.json /usr/src/app/ + +RUN npm install --unsafe-perm && npm cache clean + +COPY . /usr/src/app + +COPY test/services/ /etc/systemd/system/ + +ENV INITSYSTEM on + +RUN systemctl enable docker +CMD docker info diff --git a/lib/rsync.coffee b/lib/rsync.coffee index e4007b9..5b9f02a 100644 --- a/lib/rsync.coffee +++ b/lib/rsync.coffee @@ -43,4 +43,12 @@ exports.createRsyncStream = (src, dest) -> ps.stderr.pipe(process.stderr) ps.stdout.pipe(process.stdout) - resolve(fs.createReadStream(pipePath).on('close', cleanup)) + # Early Node 8 versions have a bug that force a seek upon creation of + # a read stream. The workaround is to pass the file descriptor directly. + # See: https://github.com/nodejs/node/issues/19240 + fs.open pipePath, 'r', (err, fd) -> + if err + cleanup() + reject(err) + else + resolve(fs.createReadStream(undefined, fd: fd).on('close', cleanup)) diff --git a/test.sh b/test.sh index 10ee2cd..6d2814e 100644 --- a/test.sh +++ b/test.sh @@ -7,7 +7,12 @@ function cleanup() { } trap cleanup EXIT -docker build -f Dockerfile.test -t localhost/docker-delta-test . +docker build -f Dockerfile.node6.test -t localhost/docker-delta-node6-test . +docker run --privileged --name deltatest -d localhost/docker-delta-node6-test +docker exec deltatest bash -c "npm run lint && ./node_modules/.bin/mocha --compilers coffee:coffee-script/register" + cleanup -docker run --privileged --name deltatest -d localhost/docker-delta-test + +docker build -f Dockerfile.node8.test -t localhost/docker-delta-node8-test . +docker run --privileged --name deltatest -d localhost/docker-delta-node8-test docker exec deltatest bash -c "npm run lint && ./node_modules/.bin/mocha --compilers coffee:coffee-script/register"