Commit d171028b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 35392a78
......@@ -354,8 +354,8 @@ def test_zodb_onresync():
# test that zurl does not change from one open to another storage open.
def test_zurlstable():
if not isinstance(testdb, testing.TestDB_FileStorage):
pytest.xfail(reason="zstor_2zurl is TODO for ZEO and NEO")
if not isinstance(testdb, (testing.TestDB_FileStorage, testing.TestDB_ZEO)):
pytest.xfail(reason="zstor_2zurl is TODO for NEO")
zurl0 = None
for i in range(10):
zstor = testdb.getZODBStorage()
......
......@@ -317,5 +317,26 @@ def zstor_2zurl(zstor):
if isinstance(zstor, FileStorage):
return "file://%s" % (zstor._file_name,)
# TODO ZEO + NEO support
ztype = type(zstor).__module__ + "." + type(zstor).__name__
if ztype == "ZEO.ClientStorage.ClientStorage":
u = "zeo://"
addr = zstor._addr
if len(addr) != 1:
raise NotImplementedError("ZEO client has multiple configured servers: %r" % (addr,))
addr = addr[0]
# addr is either TCP (host,port) or UNIX path
if isinstance(addr, str):
u += addr
else:
host, port = addr
u += '%s:%d' % (host, port)
storage = zstor._storage
if storage != "1":
u += "?storage=%s" % storage
# TODO ssl
return u
# TODO NEO support
raise NotImplementedError("don't know how to extract zurl from %r" % zstor)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment