Skip to content

Commit 0f3b2e7

Browse files
author
Hugo Osvaldo Barrera
committed
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.
1 parent c410fbf commit 0f3b2e7

File tree

5 files changed

+29
-38
lines changed

5 files changed

+29
-38
lines changed

docker-compose.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3'
2+
3+
services:
4+
xandikos:
5+
build: docker/xandikos/
6+
ports:
7+
- '8000:8000'

docker/xandikos/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Original file copyright 2017 Jelmer Vernooij
2+
3+
FROM ubuntu:bionic
4+
RUN apt-get update && apt-get -y install xandikos locales
5+
EXPOSE 8000
6+
7+
RUN locale-gen en_US.UTF-8
8+
ENV PYTHONIOENCODING=utf-8
9+
ENV LANG en_US.UTF-8
10+
ENV LANGUAGE en_US:en
11+
ENV LC_ALL en_US.UTF-8
12+
13+
CMD xandikos -d /tmp/dav -l 0.0.0.0 -p 8000 --autocreate

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ addopts = --tb=short
1010
# E743: Ambiguous function definition
1111
ignore = E731, E743
1212
# E503: Line break occurred before a binary operator
13-
extend-ignore = W503
13+
extend-ignore = E203, W503
14+
max-line-length = 88
1415
select = C,E,F,W,B,B9
1516
exclude = .eggs, tests/storage/servers/owncloud/, tests/storage/servers/nextcloud/, tests/storage/servers/baikal/, build/
1617
application-package-names = tests,vdirsyncer
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,15 @@
11
import pytest
22

3-
from xandikos.web import XandikosApp, XandikosBackend, WellknownRedirector
4-
5-
import wsgi_intercept
6-
import wsgi_intercept.requests_intercept
7-
83

94
class ServerMixin:
105
@pytest.fixture
116
def get_storage_args(self, request, tmpdir, slow_create_collection):
12-
tmpdir.mkdir('xandikos')
13-
backend = XandikosBackend(path=str(tmpdir))
14-
cup = '/user/'
15-
backend.create_principal(cup, create_defaults=True)
16-
app = XandikosApp(backend, cup)
17-
18-
app = WellknownRedirector(app, '/')
19-
20-
wsgi_intercept.requests_intercept.install()
21-
wsgi_intercept.add_wsgi_intercept('127.0.0.1', 8080, lambda: app)
22-
23-
def teardown():
24-
wsgi_intercept.remove_wsgi_intercept('127.0.0.1', 8080)
25-
wsgi_intercept.requests_intercept.uninstall()
26-
request.addfinalizer(teardown)
27-
28-
def inner(collection='test'):
29-
url = 'http://127.0.0.1:8080/'
30-
args = {'url': url, 'collection': collection}
7+
def inner(collection="test"):
8+
url = "http://127.0.0.1:8000/"
9+
args = {"url": url}
3110

3211
if collection is not None:
33-
args = self.storage_class.create_collection(**args)
12+
args = slow_create_collection(self.storage_class, args, collection)
3413
return args
14+
3515
return inner
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
#!/bin/sh
2-
set -e
32

4-
pip install wsgi_intercept
5-
6-
if [ "$REQUIREMENTS" = "release" ] || [ "$REQUIREMENTS" = "minimal" ]; then
7-
# XXX: This is the last version to support Python 3.5
8-
pip install -U "xandikos==0.0.11"
9-
elif [ "$REQUIREMENTS" = "devel" ]; then
10-
pip install -U git+https://github.com/jelmer/xandikos
11-
else
12-
echo "Invalid REQUIREMENTS value"
13-
false
14-
fi
3+
docker-compose build xandikos
4+
docker-compose up -d xandikos

0 commit comments

Comments
 (0)