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 jobs:
language: python include:
python: - stage: test supported Python versions
- 2.7 sudo: false
- 3.4 language: python
- 3.5 python:
- 3.6 - 2.7
- pypy - 3.4
- pypy3 - 3.5
- 3.6
- pypy
- pypy3
install: install:
- pip install -U setuptools pip sphinx tox tox-travis - pip install -U setuptools pip sphinx tox tox-travis
script: script:
- ./bin/test_standalone.sh - ./bin/test_standalone.sh
- tox - tox
- ./bin/check_readme.sh - ./bin/check_readme.sh
branches: branches:
except: except:
- standalone - 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"