Commit cc33d610 authored by Levin Zimmermann's avatar Levin Zimmermann Committed by Kirill Smelkov

lib/tests: Fix flaky zstor_2zurl test

Kirill noted that nexedi/wendelin.core@fb620301 introduced a regression [1]:
'test_zstor_2zurl' sometimes passes and sometimes fails. The reason for
this is that there is no deterministic order of master nodes in
'NodeManager.getMasterList()', which is why there is no specified
order of master node addresses in a zurl [2]. We don't want to normalize
a zurl returned by 'zstor_2zurl' as we need some of the client-specific
parameters as SSL file paths, so we rather fix the test to allow any
possible order of NEO master nodes in the zurl.

[1] nexedi/wendelin.core!17 (comment 188102)
[2] https://lab.nexedi.com/nexedi/wendelin.core/blob/fb620301/lib/zodb.py#L414

/reviewed-by @kirr
/reviewed-on nexedi/wendelin.core!17
parent fb620301
...@@ -505,9 +505,9 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict): ...@@ -505,9 +505,9 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict):
# assert_zurl_is_correct verifies that zstor_2zurl(zstor) returns zurl_ok. # assert_zurl_is_correct verifies that zstor_2zurl(zstor) returns zurl_ok.
# zstor is closed after this test. # zstor is closed after this test.
@func @func
def assert_zurl_is_correct(zstor, zurl_ok): def assert_zurl_is_correct(zstor, *zurl_ok):
defer(zstor.close) defer(zstor.close)
assert zstor_2zurl(zstor) == zurl_ok assert zstor_2zurl(zstor) in zurl_ok
# sslp is the ssl encryption uri part of an encrypted NEO node # sslp is the ssl encryption uri part of an encrypted NEO node
q = quote_plus q = quote_plus
...@@ -525,7 +525,9 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict): ...@@ -525,7 +525,9 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict):
_(neo("test", "127.0.0.1:1234", 1), "neos://%s@127.0.0.1:1234/test" % sslp) # + ssl _(neo("test", "127.0.0.1:1234", 1), "neos://%s@127.0.0.1:1234/test" % sslp) # + ssl
_(neo("test", "[::1]:1234"), "neo://[::1]:1234/test") # NEO/ip6 _(neo("test", "[::1]:1234"), "neo://[::1]:1234/test") # NEO/ip6
_(neo("test", "[::1]:1234", 1), "neos://%s@[::1]:1234/test" % sslp) # + ssl _(neo("test", "[::1]:1234", 1), "neos://%s@[::1]:1234/test" % sslp) # + ssl
_(neo("test", "[::1]:1234\n[::2]:1234"), "neo://[::1]:1234,[::2]:1234/test") # + 2 master nodes _(neo("test", "[::1]:1234\n[::2]:1234"), # + 2 master nodes
# Master order is not specified, so we have 2 possible/acceptable zurl
"neo://[::1]:1234,[::2]:1234/test", "neo://[::2]:1234,[::1]:1234/test")
_(demo(zeo("base", ("1.2.3.4", 5)), # DemoStorage _(demo(zeo("base", ("1.2.3.4", 5)), # DemoStorage
fs1("delta.fs")), "demo:(zeo://1.2.3.4:5?storage=base)/(file://%s/delta.fs)" % tmpdir) fs1("delta.fs")), "demo:(zeo://1.2.3.4:5?storage=base)/(file://%s/delta.fs)" % tmpdir)
......
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