Commit 6047f893 authored by Kirill Smelkov's avatar Kirill Smelkov

Y client: Don't allow master_nodes and name to be present in options

Because list of masters and cluster name must be already present in
netloc and path. Previously e.g.

	neo://α,β,γ/db?master_nodes=a,b,c"

would mean to use master nodes {a,b,c} not {α,β,γ}. Now it is treated as
invalid URI to remove ambiguity. Same for cluster name.
parent 1c026f97
...@@ -44,6 +44,8 @@ def neo_zconf_options(): ...@@ -44,6 +44,8 @@ def neo_zconf_options():
options = {k for k, _ in neo_storage_zconf} options = {k for k, _ in neo_storage_zconf}
assert 'master_nodes' in options assert 'master_nodes' in options
assert 'name' in options assert 'name' in options
options.remove('master_nodes') # comes in netloc
options.remove('name') # comes in path
for opt in _credopts: for opt in _credopts:
assert opt in options, opt assert opt in options, opt
......
...@@ -71,6 +71,10 @@ class ZODBURITests(unittest.TestCase): ...@@ -71,6 +71,10 @@ class ZODBURITests(unittest.TestCase):
# master/db not fully specified # master/db not fully specified
self.assertRaises(ValueError, _resolve_uri, "neo://master") self.assertRaises(ValueError, _resolve_uri, "neo://master")
# master_nodes and name provided in option (they come in netloc and path)
self.assertRaises(ValueError, _resolve_uri, "neo://master/db?master_nodes=a,b,c")
self.assertRaises(ValueError, _resolve_uri, "neo://master/db?name=zzz")
# option that corresponds to credential provided in query # option that corresponds to credential provided in query
self.assertRaises(ValueError, _resolve_uri, "neos://master/db?ca=123") self.assertRaises(ValueError, _resolve_uri, "neos://master/db?ca=123")
......
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