forked from github.com/pypiserver
Updated test & requirements filename
Thanks for your PR! I was wondering why everyone kept complaining about `bcrypt`, when my local tests were succeeding just fine, so I spent some time making the docker test script replicate the error. Turns out the `.htpasswd` files I was generating were using md5, so they were not triggering the error. The htpasswd file in this update does use bcrypt encryption, so it triggers a 500 error on the previous version of the Dockerfile. I also updated the test to be a bit more thorough, validating an authenticated upload in addition to just making sure the server is running. The only other change I made was to move `requirements.txt` into a more specific `docker-requirements.txt` file, just to make it clear that its intention is to be a part of the docker build and not the normal install process.
This commit is contained in:
parent
7b9d0ef285
commit
d162d660c4
@ -11,7 +11,7 @@ python:
|
||||
- pypy3
|
||||
|
||||
install:
|
||||
- pip install -U setuptools pip sphinx tox tox-travis
|
||||
- pip install -U setuptools twine pip sphinx tox tox-travis
|
||||
|
||||
script:
|
||||
- ./bin/test-docker.sh
|
||||
|
@ -17,7 +17,7 @@ FROM base as builder
|
||||
# Copy the requirements and install them
|
||||
# Do this in a separate image in a separate directory
|
||||
# to not have all the pip stuff in the final image
|
||||
COPY requirements.txt /requirements.txt
|
||||
COPY docker-requirements.txt /requirements.txt
|
||||
|
||||
# Install python packages
|
||||
RUN apk add --no-cache py2-pip \
|
||||
|
BIN
bin/pypiserver-1.2.6-py2.py3-none-any.whl
Normal file
BIN
bin/pypiserver-1.2.6-py2.py3-none-any.whl
Normal file
Binary file not shown.
@ -5,15 +5,44 @@
|
||||
|
||||
set -xe # exit on any error, show debug output
|
||||
|
||||
DIR="$( cd "$( dirname "$0" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
docker build . -t pypiserver:test
|
||||
|
||||
docker run pypiserver:test --help
|
||||
docker run pypiserver:test --help > /dev/null
|
||||
|
||||
CONTAINER_ID=$(docker run -d -p 8080:8080 pypiserver:test)
|
||||
# Mount our htpasswd file, which contains a test user with a bcrypt-encrypted
|
||||
# "test" password
|
||||
CONTAINER_ID=$(docker run \
|
||||
-d \
|
||||
-v "${DIR}/test.htpasswd:/data/.htpasswd" \
|
||||
-p 8080:8080 \
|
||||
pypiserver:test -a "list,update,download" -P /data/.htpasswd packages)
|
||||
|
||||
sleep 5 # give the contaienr some time to get going
|
||||
trap "docker container stop $CONTAINER_ID" EXIT
|
||||
|
||||
# Ensure our home page is returning something
|
||||
curl localhost:8080 | grep -q "pypiserver"
|
||||
sleep 5 # give the container some time to get going
|
||||
|
||||
docker container stop "$CONTAINER_ID"
|
||||
# Ensure we can authenticate locally
|
||||
RET=$(curl localhost:8080)
|
||||
echo $RET
|
||||
echo $RET | grep -q "pypiserver"
|
||||
|
||||
RET=$(curl localhost:8080/packages/)
|
||||
echo $RET
|
||||
echo $RET | grep -q "401"
|
||||
|
||||
|
||||
RET=$(curl test:test@localhost:8080/packages/)
|
||||
echo $RET
|
||||
echo $RET | grep -q "Index of packages"
|
||||
|
||||
twine upload \
|
||||
-u test \
|
||||
-p test \
|
||||
--repository-url http://localhost:8080 \
|
||||
"${DIR}/pypiserver-1.2.6-py2.py3-none-any.whl"
|
||||
|
||||
RET=$(curl test:test@localhost:8080/packages/)
|
||||
echo $RET
|
||||
echo $RET | grep -q "pypiserver-1.2.6"
|
||||
|
2
bin/test.htpasswd
Normal file
2
bin/test.htpasswd
Normal file
@ -0,0 +1,2 @@
|
||||
test:$2y$05$0wU8vmgucWeyLyqxB.mm1OOPf660/exARXPN5uC.gHaWziv7C4t/m
|
||||
|
Loading…
Reference in New Issue
Block a user