summaryrefslogtreecommitdiff
path: root/tests/server/test_tac.py
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-11-19 18:37:40 -0200
committerdrebs <drebs@riseup.net>2017-11-19 20:10:00 -0200
commit4f860fb97842a6e6a0a420889f99a87104fba498 (patch)
tree41395c1d646e9e4e95a39ed6bb2a48d938064841 /tests/server/test_tac.py
parent0844dc3a1a15f60757a680c819cad686b5724bf4 (diff)
[test] use environment to pass the couch_url to server TAC test
Diffstat (limited to 'tests/server/test_tac.py')
-rw-r--r--tests/server/test_tac.py26
1 files changed, 18 insertions, 8 deletions
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