From e3890a6f02f5dd5ac0913a6fa1a2e473b0ba5284 Mon Sep 17 00:00:00 2001 From: EvgeneOskin Date: Mon, 1 Feb 2016 21:05:52 +0600 Subject: [PATCH] Add docker to test installation on clear ubuntu. --- .dockerignore | 18 ++++++++++++++++++ .prospector.yaml | 3 +++ Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 5 +++++ tests/integration/login.bats | 6 +++--- tests/integration/logout.bats | 6 +++--- tests/integration/test_helper.bash | 8 ++++---- tox.ini | 6 +++--- 8 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..95a7688 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +.git +*~ +\#* +.DS_Store + +.idea +.tox +.coverage + +*.pyc +*.pyo +dist +*.egg-info +/build +.ropeproject +.eggs +__pycache__ +Dockerfile diff --git a/.prospector.yaml b/.prospector.yaml index 5d4f0ca..4f491e6 100644 --- a/.prospector.yaml +++ b/.prospector.yaml @@ -14,6 +14,9 @@ ignore-paths: # TODO Remove this file in production - serverauditor_sshconfig/sync/services/aws.py +ignore-patterns: + - (^|/)(?!serverauditor_sshconfig)?(/|$) + pep257: disable: - D203 # 1 blank line required before diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..716a10d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu + +RUN apt-get update \ + && apt-get install -y \ + python-dev \ + python3-dev \ + libffi-dev \ + libssl-dev \ + python-pip \ + python3-pip \ + python-tox \ + git \ + && git clone https://github.com/sstephenson/bats.git && cd bats && ./install.sh /usr/local/ && cd - + +ADD . /serverauditor + +WORKDIR /serverauditor + +CMD tox diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0efacdd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +cli: + build: . + environment: + SERVERAUDITOR_USERNAME: + SERVERAUDITOR_PASSWORD: diff --git a/tests/integration/login.bats b/tests/integration/login.bats index 8cba44e..2241d1f 100644 --- a/tests/integration/login.bats +++ b/tests/integration/login.bats @@ -11,12 +11,12 @@ } @test "login by tester account" { - if [ "$Serverauditor_username" == '' ] || [ "$Serverauditor_password" == '' ];then - skip '$Serverauditor_username and $Serverauditor_password are not set!' + if [ "$SERVERAUDITOR_USERNAME" == '' ] || [ "$SERVERAUDITOR_PASSWORD" == '' ];then + skip '$SERVERAUDITOR_USERNAME and $SERVERAUDITOR_PASSWORD are not set!' fi rm ~/.serverauditor || true - run serverauditor login --username $Serverauditor_username -p $Serverauditor_password + run serverauditor login --username $SERVERAUDITOR_USERNAME -p $SERVERAUDITOR_PASSWORD echo $output [ "$status" -eq 0 ] ! [ -z $(cat ~/.serverauditor) ] diff --git a/tests/integration/logout.bats b/tests/integration/logout.bats index 359812c..ce37eb3 100644 --- a/tests/integration/logout.bats +++ b/tests/integration/logout.bats @@ -11,12 +11,12 @@ } @test "login & logout by tester account" { - if [ "$Serverauditor_username" == '' ] || [ "$Serverauditor_password" == '' ];then - skip '$Serverauditor_username and $Serverauditor_password are not set!' + if [ "$SERVERAUDITOR_USERNAME" == '' ] || [ "$SERVERAUDITOR_PASSWORD" == '' ];then + skip '$SERVERAUDITOR_USERNAME and $SERVERAUDITOR_PASSWORD are not set!' fi rm ~/.serverauditor || true - serverauditor login --username $Serverauditor_username -p$Serverauditor_password + serverauditor login --username $SERVERAUDITOR_USERNAME -p$SERVERAUDITOR_PASSWORD run serverauditor logout [ "$status" -eq 0 ] diff --git a/tests/integration/test_helper.bash b/tests/integration/test_helper.bash index 008f958..407e3d1 100644 --- a/tests/integration/test_helper.bash +++ b/tests/integration/test_helper.bash @@ -1,15 +1,15 @@ login_serverauditor () { - if [ "$Serverauditor_username" == '' ] || [ "$Serverauditor_password" == '' ];then - skip '$Serverauditor_username and $Serverauditor_password are not set!' + if [ "$SERVERAUDITOR_USERNAME" == '' ] || [ "$SERVERAUDITOR_PASSWORD" == '' ];then + skip '$SERVERAUDITOR_USERNAME and $SERVERAUDITOR_PASSWORD are not set!' fi - serverauditor login --username $Serverauditor_username -p $Serverauditor_password + serverauditor login --username $SERVERAUDITOR_USERNAME -p $SERVERAUDITOR_PASSWORD } pull_serverauditor() { login_serverauditor - serverauditor pull -p $Serverauditor_password + serverauditor pull -p $SERVERAUDITOR_PASSWORD } diff --git a/tox.ini b/tox.ini index ceb1bc0..be42d42 100644 --- a/tox.ini +++ b/tox.ini @@ -4,17 +4,17 @@ # and then run "tox" from this directory. [tox] -envlist = py27,py35 +envlist = py27,py34 skipsdist = True [testenv] -deps = -rdev-requirements.txt +deps = -r{toxinidir}/dev-requirements.txt commands = pip install -U . paver nosetests paver lint paver bats -passenv = Serverauditor_username Serverauditor_password +passenv = SERVERAUDITOR_USERNAME SERVERAUDITOR_PASSWORD [flake8] exclude = .git*