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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ docker_bootstrap:
# and then runs the tests inside Docker.
# Example: $ make docker_test flavor=mariadb
docker_test:
docker/test/run.sh $(flavor)
docker/test/run.sh $(flavor) 'make test'
8 changes: 4 additions & 4 deletions docker/bootstrap/Dockerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ RUN cd /tmp && \
pip install -r src/python/requirements.txt && \
pip install src/python/src

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot

# Set up Vitess environment (equivalent to '. dev.env')
ENV VTTOP /vt/src/github.com/youtube/vitess
ENV VTROOT /vt
Expand All @@ -57,7 +54,10 @@ COPY . /vt/src/github.com/youtube/vitess

# Create vitess user
RUN groupadd -r vitess && useradd -r -g vitess vitess && \
chown -R vitess:vitess /vt
mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot

# If the user doesn't specify a command, load a shell.
CMD ["/bin/bash"]
17 changes: 13 additions & 4 deletions docker/test/run.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/bin/bash

flavor=$1
cmd=$2

if [[ -z "$flavor" ]]; then
echo "Flavor must be specified as first argument."
exit 1
fi

if [[ -z "$cmd" ]]; then
cmd=bash
fi

if [[ ! -f bootstrap.sh ]]; then
echo "This script should be run from the root of the Vitess source tree - e.g. ~/src/github.com/youtube/vitess"
exit 1
Expand All @@ -15,22 +20,26 @@ fi
# To avoid AUFS permission issues, files must allow access by "other"
chmod -R o=g *

args="-ti --rm -v /dev/log:/dev/log"
args="-ti --rm -e USER=vitess -v /dev/log:/dev/log"
args="$args -v $PWD:/tmp/src"

# Mount in host VTDATAROOT if one exists, since it might be a RAM disk or SSD.
if [[ -n "$VTDATAROOT" ]]; then
hostdir=`mktemp -d --tmpdir=$VTDATAROOT test.XXX`
hostdir=`mktemp -d --tmpdir=$VTDATAROOT test-XXX`
testid=`basename $hostdir`

chmod 777 $hostdir

echo "Mounting host dir $hostdir as VTDATAROOT"
args="$args -v $hostdir:/vt/vtdataroot --name=$testid"
args="$args -v $hostdir:/vt/vtdataroot --name=$testid -h $testid"
else
args="$args -h test"
fi

# Run tests
echo "Running tests in vitess/bootstrap:$flavor image..."
docker run $args vitess/bootstrap:$flavor \
bash -c 'rm -rf * && cp -R /tmp/src/* . && rm -rf Godeps/_workspace/pkg && make test'
bash -c "rm -rf * && cp -R /tmp/src/* . && rm -rf Godeps/_workspace/pkg && $cmd"

# Clean up host dir mounted VTDATAROOT
if [[ -n "$hostdir" ]]; then
Expand Down