summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--tests/server/test_tac.py26
-rw-r--r--tox.ini1
3 files changed, 21 insertions, 8 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2878d78c..d6a76012 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -63,6 +63,8 @@ tests:
image: 0xacab.org:4567/leap/soledad:latest
services:
- couchdb
+ variables:
+ SOLEDAD_COUCH_URL: http://couchdb:5984
script:
- tox -- --couch-url http://couchdb:5984
diff --git a/tests/server/test_tac.py b/tests/server/test_tac.py
index e2e15f44..1ebe3308 100644
--- a/tests/server/test_tac.py
+++ b/tests/server/test_tac.py
@@ -61,15 +61,25 @@ class TacServerTestCase(unittest.TestCase):
yield self._get(public_using_local_port_url)
def _spawnServer(self):
+
+ # Format the following command:
+ # /path/to/twistd --pidfile= -noy /path/to/server.tac
+ path = os.environ.get('VIRTUAL_ENV', '/usr')
+ twistd = os.path.join(path, 'bin', 'twistd')
+ args = [twistd, '--pidfile=', '-noy', TAC_FILE_PATH]
+
+ # Use a special environment when running twistd.
+ couch_url = os.environ.get('SOLEDAD_COUCH_URL')
+ env = {
+ 'DEBUG_SERVER': 'yes', # run Users API on port 2424 without TLS
+ 'SOLEDAD_COUCH_URL': couch_url, # used by gitlab ci with docker
+ }
+
protocol = ProcessProtocol()
- env = os.environ.get('VIRTUAL_ENV', '/usr')
- executable = os.path.join(env, 'bin', 'twistd')
- no_pid_argument = '--pidfile='
- args = [executable, no_pid_argument, '-noy', TAC_FILE_PATH]
- env = {'DEBUG_SERVER': 'yes'}
- t = reactor.spawnProcess(protocol, executable, args, env=env)
- self.addCleanup(os.kill, t.pid, signal.SIGKILL)
- self.addCleanup(t.loseConnection)
+ proc = reactor.spawnProcess(protocol, twistd, args, env=env)
+ self.addCleanup(os.kill, proc.pid, signal.SIGKILL)
+ self.addCleanup(proc.loseConnection)
+
d = self._wait_for_server()
return d
diff --git a/tox.ini b/tox.ini
index ca7c11f2..00aba168 100644
--- a/tox.ini
+++ b/tox.ini
@@ -42,6 +42,7 @@ setenv =
TERM=xterm
XDG_CACHE_HOME=./.cache/
CHECK_SQLCIPHER={toxinidir}/scripts/testing/ensure-pysqlcipher-has-usleep.sh
+passenv = SOLEDAD_COUCH_URL
install_command = pip install {opts} {packages}
[testenv:py34]