Skip to content

Instantly share code, notes, and snippets.

@lucj
Created May 2, 2017 13:45
Show Gist options
  • Save lucj/e31c7bd5e3d57f3bf94e9cd138e2ad2b to your computer and use it in GitHub Desktop.
Save lucj/e31c7bd5e3d57f3bf94e9cd138e2ad2b to your computer and use it in GitHub Desktop.
docker-test-sut.sh
# Cloning the repository
$ git clone [email protected]:lucj/iot-api.git
Cloning into 'iot-api'...
remote: Counting objects: 64, done.
remote: Total 64 (delta 0), reused 0 (delta 0), pack-reused 64
Receiving objects: 100% (64/64), 9.57 KiB | 0 bytes/s, done.
Resolving deltas: 100% (27/27), done.
Checking connectivity... done.
# Go into project's folder
$ cd iot-api
# Building sut service
$ docker-compose -f compose-test.yml build sut
Building sut
Step 1/10 : FROM mhart/alpine-node:7.7.1
7.7.1: Pulling from mhart/alpine-node
0a8490d0dfd3: Pull complete
d4c7568ed38f: Pull complete
Digest: sha256:be8543a6ff29c78b69fda79034d60a9ed3171bd29df3a420cdf387312f1b1df7
Status: Downloaded newer image for mhart/alpine-node:7.7.1
---> e1a533c514f2
Step 2/10 : ENV LAST_UPDATED 20170301T231500
---> Running in 6fc73a8b393a
---> 899dd9a98249
Removing intermediate container 6fc73a8b393a
Step 3/10 : RUN apk add -U curl
---> Running in 5e056188db9d
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
(1/4) Installing ca-certificates (20161130-r1)
(2/4) Installing libssh2 (1.7.0-r2)
(3/4) Installing libcurl (7.52.1-r3)
(4/4) Installing curl (7.52.1-r3)
Executing busybox-1.25.1-r0.trigger
Executing ca-certificates-20161130-r1.trigger
OK: 7 MiB in 17 packages
---> be8e2952bb9e
Removing intermediate container 5e056188db9d
Step 4/10 : COPY package.json /tmp/package.json
---> 0012df52576b
Removing intermediate container 3141cad81a34
Step 5/10 : RUN cd /tmp && npm install
---> Running in 7fc5136673b3
[email protected] /tmp
...
npm WARN [email protected] No repository field.
---> 31889f0fcc46
Removing intermediate container 7fc5136673b3
Step 6/10 : RUN mkdir /app && cp -a /tmp/node_modules /app/
---> Running in a2dca744656f
---> 7cbacfbcef58
Removing intermediate container a2dca744656f
Step 7/10 : COPY . /app/
---> 95af0fc81373
Removing intermediate container 05dce5e3f5dd
Step 8/10 : WORKDIR /app
---> 1240ff54ac08
Removing intermediate container c7bdf91418ac
Step 9/10 : EXPOSE 1337
---> Running in 8ca80a127ae3
---> 002a5b1acc34
Removing intermediate container 8ca80a127ae3
Step 10/10 : CMD npm start
---> Running in 310a08065f05
---> f7f979a03b9f
Removing intermediate container 310a08065f05
Successfully built f7f979a03b9f
Successfully tagged iotapi_sut:latest
# Running the tests
$ docker-compose -f compose-test.yml run sut
Pulling db (influxdb:latest)...
latest: Pulling from library/influxdb
cd0a524342ef: Already exists
e39c3ffe4133: Pull complete
7c4715d18523: Pull complete
882cfdc679c8: Pull complete
2284815979f4: Pull complete
c34ac4fb5dde: Pull complete
Digest: sha256:2684379df270d15e0c0f492ebc9046be950dfa4ff735d230dbf3c3454ff69fa6
Status: Downloaded newer image for influxdb:latest
Creating iotapi_db_1
HTTP/1.1 200 OK
Connection: close
Content-Type: application/json
Request-Id: 36a366cc-2f3d-11e7-8001-000000000000
X-Influxdb-Version: 1.2.3
Date: Tue, 02 May 2017 13:42:41 GMT
Transfer-Encoding: chunked
{"results":[{"statement_id":0}]}
> [email protected] test /app
> mocha test/functional.js
Creation
info: server listening on port 3000
info: ts=2017-03-11T15:00:53Z, type=temp, value=34, sensor_id=123
✓ should create dummy data (70ms)
1 passing (88ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment