mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-08 03:30:34 +00:00
* fix(runtime): fence revoked run event producers * fix(runtime): reduce off-mode producer guard locking * docs: keep inherited guidance within size budget * chore(runtime): remove development phase labels * fix(persistence): normalize libpq SSL options for asyncpg connections * docs(runtime): clarify producer fencing behavior in off mode * test(persistence): align migration TLS probes with channel-binding rejection * fix(runtime): authorize fenced Gateway history seeding * fix(scheduler): preserve takeover identity in recovery publication * fix(scheduler): report unconfirmed recovery publication * fix(runtime): preserve history messages before the first human turn * fix(runtime): clarify run creation failure diagnostic --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
42 lines
1.9 KiB
Python
42 lines
1.9 KiB
Python
"""Check the real asyncpg dialect's connection contract without a database."""
|
|
|
|
import pytest
|
|
from sqlalchemy.engine import make_url
|
|
from support.postgres import asyncpg_test_url
|
|
|
|
|
|
@pytest.mark.parametrize("scheme", ["postgres", "postgresql", "postgresql+asyncpg"])
|
|
@pytest.mark.parametrize("sslmode", [None, "disable", "allow", "prefer", "require", "verify-ca", "verify-full"])
|
|
def test_asyncpg_test_url_preserves_tls_credentials_and_other_options(scheme, sslmode):
|
|
uri = f"{scheme}://user:p%40ss%2Fword@localhost:5432/deerflow_test?target_session_attrs=read-write"
|
|
if sslmode is not None:
|
|
uri += f"&sslmode={sslmode}"
|
|
url = make_url(asyncpg_test_url(uri))
|
|
_args, kwargs = url.get_dialect()().create_connect_args(url)
|
|
assert url.drivername == "postgresql+asyncpg"
|
|
assert kwargs["password"] == "p@ss/word"
|
|
assert kwargs["target_session_attrs"] == "read-write"
|
|
assert "sslmode" not in kwargs and "channel_binding" not in kwargs
|
|
if sslmode is None:
|
|
assert "ssl" not in kwargs
|
|
else:
|
|
assert kwargs["ssl"] == sslmode
|
|
|
|
|
|
@pytest.mark.parametrize("query", ["ssl=require", "ssl=require&sslmode=require"])
|
|
def test_asyncpg_test_url_preserves_explicit_ssl(query):
|
|
url = make_url(asyncpg_test_url(f"postgresql://user:password@localhost/test?{query}"))
|
|
_args, kwargs = url.get_dialect()().create_connect_args(url)
|
|
assert kwargs["ssl"] == "require"
|
|
|
|
|
|
def test_asyncpg_test_url_rejects_conflicting_tls_options():
|
|
with pytest.raises(ValueError, match="Conflicting ssl and sslmode"):
|
|
asyncpg_test_url("postgresql://user:password@localhost/test?ssl=require&sslmode=disable")
|
|
|
|
|
|
@pytest.mark.parametrize("mode", ["require", "prefer", "disable"])
|
|
def test_asyncpg_test_url_rejects_unsupported_channel_binding(mode):
|
|
with pytest.raises(ValueError, match="channel_binding"):
|
|
asyncpg_test_url(f"postgresql://user:password@localhost/test?channel_binding={mode}")
|