kaxil commented on code in PR #64120:
URL: https://github.com/apache/airflow/pull/64120#discussion_r2979883885
##########
task-sdk/tests/task_sdk/definitions/test_connection.py:
##########
@@ -391,6 +391,15 @@ def test_connection_constructor_with_uri(self):
# uri should not exist as an attribute (it's init-only)
assert not hasattr(conn, "uri")
+ def test_connection_constructor_with_uri_keeps_extra_serialized(self):
+ """Test Connection(uri=...) keeps extra as a JSON string."""
+ conn = Connection(conn_id="test_conn",
uri="mysql://user:pass@host:3306/db?charset=utf8&timeout=30")
+
+ assert conn.extra == '{"charset": "utf8", "timeout": "30"}'
+ assert conn.extra_dejson == {"charset": "utf8", "timeout": "30"}
Review Comment:
`conn.extra` is a JSON string produced by
`json.dumps(dict(parse_qsl(...)))`. The dict key order follows the URL query
parameter order, which is stable here, but asserting exact string equality
against a hand-written JSON literal is brittle if anyone reorders the query
params in the URI. Consider comparing via `json.loads(conn.extra)` instead, the
way `test_from_uri_with_query_params` does it at line 309. Not a blocker, just
a durability thing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]