RelayServer: use in-memory DB for tests

This avoids problems where a leftover DB from one run causes "wrong
code" errors in the next.
This commit is contained in:
Brian Warner 2015-09-25 12:47:15 -07:00
parent 797074d03e
commit 4c4b5d081b
2 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,8 @@ class MyPlugin:
# accept --reactor= selection
from .relay import RelayServer
return RelayServer(self.args.rendezvous, self.args.transit,
self.args.advertise_version)
self.args.advertise_version,
"relay.sqlite")
def start_server(args):
from twisted.python import usage

View File

@ -383,9 +383,10 @@ class Root(resource.Resource):
self.putChild("", static.Data("Wormhole Relay\n", "text/plain"))
class RelayServer(service.MultiService):
def __init__(self, relayport, transitport, advertise_version):
def __init__(self, relayport, transitport, advertise_version,
db_url=":memory:"):
service.MultiService.__init__(self)
self.db = get_db("relay.sqlite")
self.db = get_db(db_url)
welcome = {
"current_version": __version__,
# adding .motd will cause all clients to display the message,