From 47c357213b4e39c6ced818de7eeb401e52bf92b9 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 26 Jan 2017 18:37:45 -0200 Subject: [refactor] move wsgi sync setup to its own module Conflicts: server/src/leap/soledad/server/_wsgi.py server/src/leap/soledad/server/entrypoint.py server/src/leap/soledad/server/resource.py testing/tests/server/test__resource.py --- testing/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testing/tests/conftest.py') diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 1ff1cbb7..decfb0a9 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -103,7 +103,7 @@ class SoledadServer(object): '--logfile=%s' % self._logfile, '--pidfile=%s' % self._pidfile, 'web', - '--wsgi=leap.soledad.server.application.wsgi_application', + '--class=leap.soledad.server.entrypoint.SoledadEntrypoint', '--port=2424' ]) -- cgit v1.2.3 From d285f07b365645a0c327a8d41402d710456583b6 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 27 Feb 2017 11:22:11 -0300 Subject: [test] use new way of indicating the tcp port for twisted web --- testing/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testing/tests/conftest.py') diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index decfb0a9..1d3125d5 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -104,7 +104,7 @@ class SoledadServer(object): '--pidfile=%s' % self._pidfile, 'web', '--class=leap.soledad.server.entrypoint.SoledadEntrypoint', - '--port=2424' + '--port=tcp:2424' ]) def _create_conf_file(self): -- cgit v1.2.3 From 5af57250f2b1cd174fa75c559bac6ea179c43d09 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 28 Feb 2017 10:22:06 -0300 Subject: [test] bugfix: actually use an empty local db in download benchmarks We were previously not using an empty local db for download benchmark tests, so there was actually nothing to sync. This commit fixes that by adding a way to force an empty local db on soledad client instantiation. --- testing/tests/conftest.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'testing/tests/conftest.py') diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 1d3125d5..49cc35f6 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -191,9 +191,19 @@ def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs, request): soledad_dbs(default_uuid) # get a soledad instance - def create(): - secrets_path = os.path.join(tmpdir.strpath, '%s.secret' % default_uuid) - local_db_path = os.path.join(tmpdir.strpath, '%s.db' % default_uuid) + def create(force_fresh_db=False): + secrets_file = '%s.secret' % default_uuid + secrets_path = os.path.join(tmpdir.strpath, secrets_file) + + # in some tests we might want to use the same user and remote database + # but with a clean/empty local database (i.e. download benchmarks), so + # here we provide a way to do that. + db_file = '%s.db' % default_uuid + if force_fresh_db: + prefix = uuid4().hex + db_file = prefix + '-' + db_file + local_db_path = os.path.join(tmpdir.strpath, db_file) + soledad_client = Soledad( default_uuid, unicode(passphrase), -- cgit v1.2.3 From 32c950d16e7bea55bb7af3f4650af857be9027e0 Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 1 Mar 2017 21:02:41 -0300 Subject: [test] improve twistd startup and termination - use subprocess.check_call() to ensure any errors during twistd startup will properly show up on test reports. - use SIGTERM instead of SIGKILL to gracefully terminate twistd. --- testing/tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'testing/tests/conftest.py') diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 49cc35f6..c077828f 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -6,7 +6,7 @@ import signal import time from hashlib import sha512 -from subprocess import call +from subprocess import check_call from urlparse import urljoin from uuid import uuid4 @@ -98,7 +98,7 @@ class SoledadServer(object): def start(self): self._create_conf_file() # start the server - call([ + check_call([ 'twistd', '--logfile=%s' % self._logfile, '--pidfile=%s' % self._pidfile, @@ -118,7 +118,7 @@ class SoledadServer(object): def stop(self): pid = get_pid(self._pidfile) - os.kill(pid, signal.SIGKILL) + os.kill(pid, signal.SIGTERM) @pytest.fixture(scope='module') -- cgit v1.2.3