From d6c1b1847cc73814fa213f5234d3908e81b35eca Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 10:59:17 +0200 Subject: [PATCH 1/3] Fix a few linting errors --- tests/storage/test_filesystem.py | 36 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/storage/test_filesystem.py b/tests/storage/test_filesystem.py index f85c1f3..d14999c 100644 --- a/tests/storage/test_filesystem.py +++ b/tests/storage/test_filesystem.py @@ -46,38 +46,40 @@ class TestFilesystemStorage(StorageTests): def test_ignore_tmp_files(self, tmpdir): """Test that files with .tmp suffix beside .ics files are ignored.""" - s = self.storage_class(str(tmpdir), '.ics') - s.upload(Item('UID:xyzxyz')) - item_file, = tmpdir.listdir() - item_file.copy(item_file.new(ext='tmp')) + s = self.storage_class(str(tmpdir), ".ics") + s.upload(Item("UID:xyzxyz")) + (item_file,) = tmpdir.listdir() + item_file.copy(item_file.new(ext="tmp")) assert len(tmpdir.listdir()) == 2 assert len(list(s.list())) == 1 def test_ignore_tmp_files_empty_fileext(self, tmpdir): """Test that files with .tmp suffix are ignored with empty fileext.""" - s = self.storage_class(str(tmpdir), '') - s.upload(Item('UID:xyzxyz')) - item_file, = tmpdir.listdir() - item_file.copy(item_file.new(ext='tmp')) + s = self.storage_class(str(tmpdir), "") + s.upload(Item("UID:xyzxyz")) + (item_file,) = tmpdir.listdir() + item_file.copy(item_file.new(ext="tmp")) assert len(tmpdir.listdir()) == 2 # assert False, tmpdir.listdir() # enable to see the created filename assert len(list(s.list())) == 1 def test_ignore_files_typical_backup(self, tmpdir): """Test file-name ignorance with typical backup ending ~.""" - ignorext = "~" # without dot - s = self.storage_class(str(tmpdir), '', fileignoreext="~") - s.upload(Item('UID:xyzxyz')) - item_file, = tmpdir.listdir() - item_file.copy(item_file.new(basename=item_file.basename+'~')) + ignorext = "~" # without dot + + storage = self.storage_class(str(tmpdir), "", fileignoreext=ignorext) + storage.upload(Item("UID:xyzxyz")) + (item_file,) = tmpdir.listdir() + item_file.copy(item_file.new(basename=item_file.basename + ignorext)) + assert len(tmpdir.listdir()) == 2 - #assert False, tmpdir.listdir() # enable to see the created filename - assert len(list(s.list())) == 1 + assert len(list(storage.list())) == 1 def test_too_long_uid(self, tmpdir): - s = self.storage_class(str(tmpdir), ".txt") + storage = self.storage_class(str(tmpdir), ".txt") item = Item("UID:" + "hue" * 600) - href, etag = s.upload(item) + + href, etag = storage.upload(item) assert item.uid not in href def test_post_hook_inactive(self, tmpdir, monkeypatch): From 0e47775ce391ea7897b62073ad75f168c81d5d41 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 10:03:15 +0200 Subject: [PATCH 2/3] Remove unused submodules These submodules were used to bootstrap local test servers for running integration tests. We'll be reusing that codebase inside docker containers, but don't want the containers built for each push to this repo -- that'll happen in a separate repository. --- .gitmodules | 6 ------ Makefile | 3 --- tests/storage/servers/nextcloud | 1 - tests/storage/servers/owncloud | 1 - 4 files changed, 11 deletions(-) delete mode 100644 .gitmodules delete mode 160000 tests/storage/servers/nextcloud delete mode 160000 tests/storage/servers/owncloud diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 0f685d2..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "tests/storage/servers/owncloud"] - path = tests/storage/servers/owncloud - url = https://github.com/vdirsyncer/owncloud-testserver -[submodule "tests/storage/servers/nextcloud"] - path = tests/storage/servers/nextcloud - url = https://github.com/vdirsyncer/nextcloud-testserver diff --git a/Makefile b/Makefile index 6f7b7a1..4ca8f2b 100644 --- a/Makefile +++ b/Makefile @@ -63,9 +63,6 @@ all: install-servers: set -ex; \ for server in $(DAV_SERVER); do \ - if [ ! "$$(ls $(TESTSERVER_BASE)$$server/)" ]; then \ - git submodule update --init -- "$(TESTSERVER_BASE)$$server"; \ - fi; \ (cd $(TESTSERVER_BASE)$$server && sh install.sh); \ done diff --git a/tests/storage/servers/nextcloud b/tests/storage/servers/nextcloud deleted file mode 160000 index a27144d..0000000 --- a/tests/storage/servers/nextcloud +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a27144ddcf39a3283179a4f7ce1ab22b2e810205 diff --git a/tests/storage/servers/owncloud b/tests/storage/servers/owncloud deleted file mode 160000 index bb4fcc6..0000000 --- a/tests/storage/servers/owncloud +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bb4fcc6f524467d58c95f1dcec8470fdfcd65adf From d747977af2467e0a956e3b18571d941b78977f5d Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 10:54:56 +0200 Subject: [PATCH 3/3] Use externally-built containers for test servers This speeds up CI by avoiding a rebuild of these container on each run. --- docker/radicale/Dockerfile | 5 ----- docker/xandikos/Dockerfile | 13 ------------- tests/storage/servers/radicale/install.sh | 5 +---- tests/storage/servers/xandikos/install.sh | 5 +---- 4 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 docker/radicale/Dockerfile delete mode 100644 docker/xandikos/Dockerfile diff --git a/docker/radicale/Dockerfile b/docker/radicale/Dockerfile deleted file mode 100644 index 462c5e2..0000000 --- a/docker/radicale/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM python:3.8 - -RUN pip install radicale - -CMD radicale --storage-filesystem-folder /tmp/dav -H 0.0.0.0:8001 -D diff --git a/docker/xandikos/Dockerfile b/docker/xandikos/Dockerfile deleted file mode 100644 index 464450c..0000000 --- a/docker/xandikos/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -# 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 diff --git a/tests/storage/servers/radicale/install.sh b/tests/storage/servers/radicale/install.sh index 690c9f3..fdeaff9 100644 --- a/tests/storage/servers/radicale/install.sh +++ b/tests/storage/servers/radicale/install.sh @@ -1,6 +1,3 @@ #!/bin/sh -cd $(git rev-parse --show-toplevel) - -docker build -t radicale docker/radicale -docker run -d -p 8001:8001 radicale +docker run -d -p 8001:8001 whynothugo/vdirsyncer-devkit-radicale diff --git a/tests/storage/servers/xandikos/install.sh b/tests/storage/servers/xandikos/install.sh index ff322b9..aa7b089 100644 --- a/tests/storage/servers/xandikos/install.sh +++ b/tests/storage/servers/xandikos/install.sh @@ -1,6 +1,3 @@ #!/bin/sh -cd $(git rev-parse --show-toplevel) - -docker build -t xandikos docker/xandikos -docker run -d -p 8000:8000 xandikos +docker run -d -p 8000:8000 whynothugo/vdirsyncer-devkit-xandikos