Add simple functional tests for docker

This commit is contained in:
Matthew Planchard 2018-06-26 21:19:03 -05:00
parent 47231ea5fb
commit 3e1a399fe3
2 changed files with 47 additions and 18 deletions

@ -1,21 +1,31 @@
sudo: false
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
jobs:
include:
- stage: test supported Python versions
sudo: false
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
install:
- pip install -U setuptools pip sphinx tox tox-travis
install:
- pip install -U setuptools pip sphinx tox tox-travis
script:
- ./bin/test_standalone.sh
- tox
- ./bin/check_readme.sh
script:
- ./bin/test_standalone.sh
- tox
- ./bin/check_readme.sh
branches:
except:
- standalone
branches:
except:
- standalone
- stage: test Docker image
sudo: required
services:
- docker
scirpt:
- bin/test-docker.sh

19
bin/test-docker.sh Executable file

@ -0,0 +1,19 @@
#!/usr/bin/env sh
# Perform some simple validation to make sure the Docker image works
# Should be run from the repo root.
set -xe # exit on any error, show debug output
docker build . -t pypiserver:test
docker run pypiserver:test --help
CONTAINER_ID=$(docker run -d -p 8080:8080 pypiserver:test)
sleep 5 # give the contaienr some time to get going
# Ensure our home page is returning something
curl localhost:8080 | grep -q "pypiserver"
docker container stop "$CONTAINER_ID"