Skip to content

Commit

Permalink
Run tests in a docker container
Browse files Browse the repository at this point in the history
Closes apache#504

Signed-off-by: Tomaz Muraus <[email protected]>
  • Loading branch information
MatthiasWiesner authored and Kami committed Apr 16, 2015
1 parent 407fce9 commit 27070b6
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*.py[co]
*.sw[po]
libcloud/test/secrets.py
demos/secrets.py
*~
.tox
_trial_temp
build
MANIFEST
/.ropeproject/config.py
/.coverage
coverage_html_report/
.idea
dist/*apache-libcloud*
dist/*apache_libcloud*
docs/apidocs/*
_build/
apache_libcloud.egg-info/
.project
.pydevproject
.settings
.git*
Dockerfile*
38 changes: 38 additions & 0 deletions contrib/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ubuntu:14.04

RUN set -e && \
apt-get update && \
apt-get install -y \
software-properties-common \
wget \
ssh && \
add-apt-repository ppa:fkrull/deadsnakes && \
apt-get update && \
apt-get -y install \
python2.6 \
python2.7 \
python3.2 \
python3.3 \
python3.4 \
python-dev \
python2.6-dev \
python2.7-dev \
python3.2-dev \
python3.3-dev \
python3.4-dev \
python-pip

RUN set -e && \
wget https://bitbucket.org/pypy/pypy/downloads/pypy-2.5.0-linux64.tar.bz2 && \
tar xf ./pypy-2.5.0-linux64.tar.bz2 -C /opt && \
ln -s /opt/pypy-2.5.0-linux64/bin/pypy /usr/local/bin/pypy

RUN set -e && \
pip install tox \
mock \
lockfile \
coverage

COPY . /libcloud
WORKDIR /libcloud
CMD tox
30 changes: 30 additions & 0 deletions contrib/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
# The script needs docker to be installed.
#
# Script which builds a testing docker image and container,
# install the necessary packages: pypy, pip, python versions
# 2.6, 2.7, 3.2, 3.3, 3.4 (corresponding dev packages as well)
# and run the tox tests within the container.
# The script has to be run from libcloud root.

set -e
docker build -f contrib/Dockerfile -t libcloud_runtest_img .
docker run --rm --name libcloud_runtest_instance libcloud_runtest_img
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py25,py26,py27,pypy,py32,py33,py34,lint
envlist = py26,py27,pypy,py32,py33,py34,lint
setenv =
PIP_USE_MIRRORS=1

Expand Down

0 comments on commit 27070b6

Please sign in to comment.