Added tox environment for running api tests using docker

Change-Id: I0b9f6a34218e52ebe6cda590eb271d9e49ed8186
This commit is contained in:
amitgandhinz 2014-11-18 14:23:40 -05:00
parent 6c938bc8e7
commit 181bdbcba0
8 changed files with 78 additions and 19 deletions

2
.gitignore vendored
View File

@ -43,7 +43,7 @@ docker_rsa*
write_file
.settings/*
Dockerfile
/Dockerfile
# patch files
*.patch

View File

@ -2,7 +2,6 @@ Before Starting
---------------
The following files should exist in this folder before running Dockerfile
* docker_rsa (private key) -> public key should be published to the private git repo
* poppy.conf (desired configuration for poppy api)
* logging.conf (desired logging configuration file)

View File

@ -2,28 +2,26 @@ Before Starting
---------------
The following files should exist in this folder before running Dockerfile
* docker_rsa (private key) -> public key should be published to the private git repo
* poppy.conf (desired configuration for poppy api)
* logging.conf (desired logging configuration file)
Install Fig::
$ sudo pip install -U fig
Building and Running the Poppy API Server
-----------------------------------------
Building the Poppy Server Docker Image
--------------------------------------
From this folder, run::
Copy the Dockerfile to the /poppy root folder, then run::
$ dev up
$ docker build -t poppy .
Note that `dev` is a wrapper around the [`fig` CLI](http://www.fig.sh/cli.html) so
any sub-commands that work with the fig CLI will work with `dev` as well.
Also note that the `fig_dev.yml` file in this folder cannot be used directly with
`fig`. Please invoke `dev` instead as it does some extra setup before internally
invoking `fig`.
Running the Poppy Docker Container
--------------------------------------
Name the container 'poppy'::
$ docker run -d -p 81:8081 --name poppy poppy
Testing
--------
@ -31,3 +29,9 @@ Testing
Access the running poppy api instance home document::
$ curl <docker_ip>/v1.0/
Next Steps
----------
If running locally with Cassandra, ensure the Cassandra Docker Container is running and linked.

View File

@ -1,9 +1,11 @@
## Prerequisites
1. Install Fig::
Install Fig::
$ sudo pip install -U fig
Install Poppy from Upstream
---------------------------
Build and Run::
$ fig up -d
@ -24,3 +26,26 @@ To get the most-updated code of poppy::
$ fig run poppy git --git-dir=/home/poppy/.git pull
$ fig run poppy uwsgi --reload /var/run/poppy/poppy.pid
Mounting a local Poppy Volume
-----------------------------
1. Build and Run::
$ dev up
Note that `dev` is a wrapper around the [`fig` CLI](http://www.fig.sh/cli.html) so
any sub-commands that work with the fig CLI will work with `dev` as well.
Also note that the `fig_dev.yml` file in this folder cannot be used directly with
`fig`. Please invoke `dev` instead as it does some extra setup before internally
invoking `fig`.
Testing
--------
Access the running poppy api instance home document::
$ curl <docker_ip>/v1.0/

View File

@ -4,7 +4,8 @@ THIS_DIR=$(dirname $0)
PROJECT_ROOT_DIR=$THIS_DIR/../..
# Copy Dockerfile from this folder to project root folder
cp $THIS_DIR/Dockerfile $PROJECT_ROOT_DIR/
cp $PROJECT_ROOT_DIR/docker/api_dev/Dockerfile $PROJECT_ROOT_DIR/
# Bring up development environment
cd $THIS_DIR
FIG_FILE=fig_dev.yml fig $@

View File

@ -39,3 +39,11 @@ run via tox. It is assumed you already have the Cassandra instance up &
running locally. You can make the API tests part of tox, by overriding the
default positional argument in tox.ini::
example : tox -- --exclude=None
Alternatively, you can run tox with docker containers running Cassandra::
This will require docker (or boot2docker for MacOSX) to already be installed on the system.
Dont forget to update your ~/.poppy/tests.conf to point to your docker ip.
example : tox -e apidocker

22
tox.ini
View File

@ -60,3 +60,25 @@ exclude = .venv*,venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,
[hacking]
import_exceptions = poppy.openstack.common.gettextutils._
[testenv:apidocker]
deps = -r{toxinidir}/requirements/requirements.txt
-r{toxinidir}/tests/test-requirements.txt
whitelist_externals = docker
setenv = CAFE_CONFIG_FILE_PATH={homedir}/.poppy/tests.conf
CAFE_ROOT_LOG_PATH={homedir}/.poppy/logs
CAFE_TEST_LOG_PATH={homedir}/.poppy/logs
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
NOSE_OPENSTACK_STDOUT=1
commands =
pip install git+https://github.com/stackforge/opencafe.git#egg=cafe
pip install -U fig
{toxinidir}/docker/fig/dev up -d
nosetests api --nologcapture