mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Test xandikos running it in docker
The main advantage here is that its dependencies are TOTALLY separate from vdirsyncer's, keeping the runtime environment for vdirsyncer cleaner. It also makes testing locally not only possible, but fast and pleasant.
This commit is contained in:
parent
c410fbf331
commit
0f3b2e74c0
5 changed files with 29 additions and 38 deletions
7
docker-compose.yaml
Normal file
7
docker-compose.yaml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
xandikos:
|
||||||
|
build: docker/xandikos/
|
||||||
|
ports:
|
||||||
|
- '8000:8000'
|
||||||
13
docker/xandikos/Dockerfile
Normal file
13
docker/xandikos/Dockerfile
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Original file copyright 2017 Jelmer Vernooij
|
||||||
|
|
||||||
|
FROM ubuntu:bionic
|
||||||
|
RUN apt-get update && apt-get -y install xandikos locales
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
RUN locale-gen en_US.UTF-8
|
||||||
|
ENV PYTHONIOENCODING=utf-8
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LANGUAGE en_US:en
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
|
CMD xandikos -d /tmp/dav -l 0.0.0.0 -p 8000 --autocreate
|
||||||
|
|
@ -10,7 +10,8 @@ addopts = --tb=short
|
||||||
# E743: Ambiguous function definition
|
# E743: Ambiguous function definition
|
||||||
ignore = E731, E743
|
ignore = E731, E743
|
||||||
# E503: Line break occurred before a binary operator
|
# E503: Line break occurred before a binary operator
|
||||||
extend-ignore = W503
|
extend-ignore = E203, W503
|
||||||
|
max-line-length = 88
|
||||||
select = C,E,F,W,B,B9
|
select = C,E,F,W,B,B9
|
||||||
exclude = .eggs, tests/storage/servers/owncloud/, tests/storage/servers/nextcloud/, tests/storage/servers/baikal/, build/
|
exclude = .eggs, tests/storage/servers/owncloud/, tests/storage/servers/nextcloud/, tests/storage/servers/baikal/, build/
|
||||||
application-package-names = tests,vdirsyncer
|
application-package-names = tests,vdirsyncer
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,15 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from xandikos.web import XandikosApp, XandikosBackend, WellknownRedirector
|
|
||||||
|
|
||||||
import wsgi_intercept
|
|
||||||
import wsgi_intercept.requests_intercept
|
|
||||||
|
|
||||||
|
|
||||||
class ServerMixin:
|
class ServerMixin:
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def get_storage_args(self, request, tmpdir, slow_create_collection):
|
def get_storage_args(self, request, tmpdir, slow_create_collection):
|
||||||
tmpdir.mkdir('xandikos')
|
def inner(collection="test"):
|
||||||
backend = XandikosBackend(path=str(tmpdir))
|
url = "http://127.0.0.1:8000/"
|
||||||
cup = '/user/'
|
args = {"url": url}
|
||||||
backend.create_principal(cup, create_defaults=True)
|
|
||||||
app = XandikosApp(backend, cup)
|
|
||||||
|
|
||||||
app = WellknownRedirector(app, '/')
|
|
||||||
|
|
||||||
wsgi_intercept.requests_intercept.install()
|
|
||||||
wsgi_intercept.add_wsgi_intercept('127.0.0.1', 8080, lambda: app)
|
|
||||||
|
|
||||||
def teardown():
|
|
||||||
wsgi_intercept.remove_wsgi_intercept('127.0.0.1', 8080)
|
|
||||||
wsgi_intercept.requests_intercept.uninstall()
|
|
||||||
request.addfinalizer(teardown)
|
|
||||||
|
|
||||||
def inner(collection='test'):
|
|
||||||
url = 'http://127.0.0.1:8080/'
|
|
||||||
args = {'url': url, 'collection': collection}
|
|
||||||
|
|
||||||
if collection is not None:
|
if collection is not None:
|
||||||
args = self.storage_class.create_collection(**args)
|
args = slow_create_collection(self.storage_class, args, collection)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
return inner
|
return inner
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
|
||||||
|
|
||||||
pip install wsgi_intercept
|
docker-compose build xandikos
|
||||||
|
docker-compose up -d xandikos
|
||||||
if [ "$REQUIREMENTS" = "release" ] || [ "$REQUIREMENTS" = "minimal" ]; then
|
|
||||||
# XXX: This is the last version to support Python 3.5
|
|
||||||
pip install -U "xandikos==0.0.11"
|
|
||||||
elif [ "$REQUIREMENTS" = "devel" ]; then
|
|
||||||
pip install -U git+https://github.com/jelmer/xandikos
|
|
||||||
else
|
|
||||||
echo "Invalid REQUIREMENTS value"
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue