Skip to content

Commit

Permalink
Resolves #41: Starting smoke tests from docker-compose. (#43)
Browse files Browse the repository at this point in the history
* Resolves #41: Starting unit test from docker-compose.

* Fixing fdbserver startup script.

* Adding license header.
  • Loading branch information
apkar authored Jan 16, 2019
1 parent 1ced656 commit d2840e9
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 3 deletions.
6 changes: 5 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM foundationdb/foundationdb-build:0.0.2
LABEL version=0.0.2
LABEL version=0.0.3
LABEL description="This image contains all the dependecies for FoundationDB Document Layer CI. \
For more details on how to use this image look at project README file at \
https://github.com/FoundationDB/fdb-document-layer"
Expand All @@ -13,3 +13,7 @@ RUN mkdir -p /opt && \
./b2 install --with-filesystem --with-system

ENV PATH=$PATH:/opt/cmake-3.12.1-Linux-x86_64/bin

RUN pip install pymongo==3.6.1 python-dateutil PyYaml

RUN apt-get install -y dnsutils=1:9.9.5.dfsg-9ubuntu0.5
24 changes: 22 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ version: "3"

services:
common: &common
image: fdb-document-layer-build:0.0.2
image: fdb-document-layer-build:0.0.3
build:
context: .
dockerfile: Dockerfile

fdbserver:
image: fdb-standalone:0.0.2
build:
context: fdbserver
args:
- FDB_VERSION=6.0.15
environment:
- FDB_PORT=4500

build-setup: &build-setup
<<: *common
depends_on: [common]
Expand All @@ -25,7 +34,14 @@ services:
<<: *build-setup
environment:
- MAKEPROCS=1
command: bash -cl 'mkdir -p build && cd build && cmake .. && make -j "$${MAKEJOBS}" && make package'
- FDB_HOST=fdbserver
- FDB_PORT=4500
command: bash -cl 'mkdir -p build && cd build && cmake .. && make -j "$${MAKEJOBS}" && cd .. && bash run-tests.bash'
links:
- fdbserver
depends_on:
- fdbserver


build-prb:
<<: *build-snapshot
Expand All @@ -35,3 +51,7 @@ services:
volumes:
- ..:/fdb-document-layer
entrypoint: /bin/bash
links:
- fdbserver
depends_on:
- fdbserver
8 changes: 8 additions & 0 deletions docker/fdbserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG FDB_VERSION=6.0.15

FROM foundationdb/foundationdb:$FDB_VERSION
LABEL version=0.0.2

COPY local_fdb.bash /var/fdb/scripts/

CMD /var/fdb/scripts/local_fdb.bash
32 changes: 32 additions & 0 deletions docker/fdbserver/local_fdb.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# local_fdb.bash
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# MongoDB is a registered trademark of MongoDB, Inc.
#

set -ex

/var/fdb/scripts/fdb.bash &
FDB_PID=$!

sleep 1
fdbcli --exec "configure new single memory;"

wait ${FDB_PID}
33 changes: 33 additions & 0 deletions run-tests.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# run-tests.bash
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# MongoDB is a registered trademark of MongoDB, Inc.
#

set -ex

FDB_HOST_IP=$(dig +short ${FDB_HOST})

echo "docker:docker@${FDB_HOST_IP}:${FDB_PORT}" > fdb.cluster

./build/bin/fdbdoc -l 127.0.0.1:27000 -d test -VV > test.out 2> test.err &

cd test/correctness/
python document-correctness.py --doclayer-port 27000 unit doclayer mm

0 comments on commit d2840e9

Please sign in to comment.