Commit 6032b274 authored by Levin Zimmermann's avatar Levin Zimmermann Committed by Kirill Smelkov

qa: lib/tests/zodb += zurl_normalize_main

After moving zurl filtering to a dedicated function, we can
now test this function for correctness. It's important that different
clients which point to the same storage always result in the same
zodburi, even if their initial user-specified zodburi slightly differs
(e.g. due to different client-side parameters or different paths of encryption).

/reviewed-by @kirr
/reviewed-on !17
parent ae54c563
# -*- coding: utf-8 -*-
# Wendelin.core.bigfile | Tests for ZODB utilities and critical properties of ZODB itself
# Copyright (C) 2014-2022 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
......@@ -17,7 +18,7 @@
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
from wendelin.lib.zodb import LivePersistent, deactivate_btree, dbclose, zconn_at, zstor_2zurl, zmajor, _zhasNXDPatch, dbstoropen
from wendelin.lib.zodb import LivePersistent, deactivate_btree, dbclose, zconn_at, zstor_2zurl, zmajor, _zhasNXDPatch, dbstoropen, zurl_normalize_main
from wendelin.lib.testing import getTestDB
from wendelin.lib import testing
from persistent import Persistent, UPTODATE, GHOST, CHANGED
......@@ -541,6 +542,26 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict):
zstor_2zurl("I am not a storage.")
@pytest.mark.parametrize(
"zurl,zurl_norm_ok",
[
# FileStorage
("file://Data.fs", "file://Data.fs"),
# ZEO
("zeo://localhost:9001", "zeo://localhost:9001"),
# NEO
("neo://127.0.0.1:1234/cluster", "neo://127.0.0.1:1234/cluster"),
# Different SSL paths
("neos://ca=a&key=b&cert=c@xyz:1/cluster", "neos://xyz:1/cluster"),
("neos://ca=α&key=β&cert=γ@xyz:1/cluster", "neos://xyz:1/cluster"),
],
)
def test_zurl_normalize_main(zurl, zurl_norm_ok):
assert zurl_normalize_main(zurl) == zurl_norm_ok
# also verify that zurl_normalize_main is stable
assert zurl_normalize_main(zurl_norm_ok) == zurl_norm_ok
# neo_ssl_dict returns the path of precomputed static ssl certificate
# files.
@pytest.fixture
......
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