Skip to content

Commit

Permalink
Add docker to test installation on clear ubuntu.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeneOskin committed Feb 1, 2016
1 parent a113c35 commit e3890a6
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 13 deletions.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.git
*~
\#*
.DS_Store

.idea
.tox
.coverage

*.pyc
*.pyo
dist
*.egg-info
/build
.ropeproject
.eggs
__pycache__
Dockerfile
3 changes: 3 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cli:
build: .
environment:
SERVERAUDITOR_USERNAME:
SERVERAUDITOR_PASSWORD:
6 changes: 3 additions & 3 deletions tests/integration/login.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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) ]
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/logout.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_helper.bash
Original file line number Diff line number Diff line change
@@ -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

}
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down

0 comments on commit e3890a6

Please sign in to comment.