Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
test(api): replace TiDB service test mocks with recording fakes (#44853)
Eddy ZHANGf7c894247549
diff --git a/api/providers/vdb/vdb-tidb-on-qdrant/tests/unit_tests/src/dify_vdb_tidb_on_qdrant/test_tidb_service.py b/api/providers/vdb/vdb-tidb-on-qdrant/tests/unit_tests/src/dify_vdb_tidb_on_qdrant/test_tidb_service.pyindex 7c3f828e73d..a0b25e59292 100644--- a/api/providers/vdb/vdb-tidb-on-qdrant/tests/unit_tests/src/dify_vdb_tidb_on_qdrant/test_tidb_service.py+++ b/api/providers/vdb/vdb-tidb-on-qdrant/tests/unit_tests/src/dify_vdb_tidb_on_qdrant/test_tidb_service.py@@ -1,6 +1,7 @@-from unittest.mock import MagicMock, patch+from dataclasses import dataclassimport dify_vdb_tidb_on_qdrant.tidb_service as tidb_service_module+import httpximport pytestfrom dify_vdb_tidb_on_qdrant.tidb_service import TidbServicefrom sqlalchemy.orm import Session@@ -9,85 +10,163 @@ from models.dataset import TidbAuthBindingfrom models.enums import TidbAuthBindingStatus+@dataclass(frozen=True)+class ApiKeys:+ """Stands in for ``DigestAuth`` so each recorded request shows the credentials it carries."""++ public_key: str+ private_key: str+++@dataclass(frozen=True)+class CloudRequest:+ """One request sent to the TiDB Cloud API."""++ method: str+ url: str+ auth: object+ params: object = None+++class FakeTidbCloudClient:+ """Stands in for the pooled TiDB Cloud client: answers with queued replies and records each request."""++ def __init__(self) -> None:+ self._replies: list[httpx.Response | Exception] = []+ self.requests: list[CloudRequest] = []++ def queue(self, *replies: httpx.Response | Exception) -> None:+ self._replies.extend(replies)++ def post(self, url: str, *, json: object, auth: object) -> httpx.Response:+ return self._reply(CloudRequest("POST", url, auth))++ def get(self, url: str, *, auth: object, params: object = None, timeout: object = None) -> httpx.Response:+ return self._reply(CloudRequest("GET", url, auth, params))++ def _reply(self, request: CloudRequest) -> httpx.Response:+ self.requests.append(request)+ reply = self._replies.pop(0)+ if isinstance(reply, Exception):+ raise reply+ # raise_for_status() needs the request that produced the response.+ reply.request = httpx.Request(request.method, request.url)+ return reply+++class FakeRedis:+ """The parts of ``redis_client`` that batch creation uses, with a fixed set of cached values."""++ def __init__(self, cached: dict[str, bytes] | None = None) -> None:+ self._cached = cached or {}+ self.setex_calls: list[tuple[str, int, str]] = []++ def setex(self, name: str, seconds: int, value: str) -> None:+ self.setex_calls.append((name, seconds, value))++ def get(self, name: str) -> bytes | None:+ return self._cached.get(name)+++def cloud_client(monkeypatch: pytest.MonkeyPatch) -> FakeTidbCloudClient:+ client = FakeTidbCloudClient()+ monkeypatch.setattr(tidb_service_module, "_tidb_http_client", client)+ monkeypatch.setattr(tidb_service_module, "DigestAuth", ApiKeys)+ return client+++def sleeps(monkeypatch: pytest.MonkeyPatch) -> list[float]:+ recorded: list[float] = []+ monkeypatch.setattr(tidb_service_module.time, "sleep", recorded.append)+ return recorded+++KEYS = ApiKeys("pub", "priv")++class TestExtractQdrantEndpoint:"""Unit tests for TidbService.extract_qdrant_endpoint."""- def test_returns_endpoint_when_host_present(self):+ def test_returns_endpoint_when_host_present(self) -> None:response = {"endpoints": {"public": {"host": "gateway01.us-east-1.tidbcloud.com", "port": 4000}}}result = TidbService.extract_qdrant_endpoint(response)assert result == "https://qdrant-gateway01.us-east-1.tidbcloud.com"- def test_returns_none_when_host_missing(self):- response = {"endpoints": {"public": {}}}+ def test_returns_none_when_host_missing(self) -> None:+ response: dict[str, dict[str, dict[str, str]]] = {"endpoints": {"public": {}}}assert TidbService.extract_qdrant_endpoint(response) is None- def test_returns_none_when_public_missing(self):- response = {"endpoints": {}}+ def test_returns_none_when_public_missing(self) -> None:+ response: dict[str, dict[str, str]] = {"endpoints": {}}assert TidbService.extract_qdrant_endpoint(response) is None- def test_returns_none_when_endpoints_missing(self):+ def test_returns_none_when_endpoints_missing(self) -> None:assert TidbService.extract_qdrant_endpoint({}) is Noneclass TestFetchQdrantEndpoint:"""Unit tests for TidbService.fetch_qdrant_endpoint."""- @patch.object(TidbService, "get_tidb_serverless_cluster")- def test_returns_endpoint_when_host_present(self, mock_get_cluster):- mock_get_cluster.return_value = {- "endpoints": {"public": {"host": "gateway01.us-east-1.tidbcloud.com", "port": 4000}}- }+ def test_returns_endpoint_when_host_present(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(+ httpx.Response(+ 200, json={"endpoints": {"public": {"host": "gateway01.us-east-1.tidbcloud.com", "port": 4000}}}+ )+ )result = TidbService.fetch_qdrant_endpoint("url", "pub", "priv", "c-123")assert result == "https://qdrant-gateway01.us-east-1.tidbcloud.com"+ assert cloud_client.requests == [CloudRequest("GET", "url/clusters/c-123", KEYS)]- @patch.object(TidbService, "get_tidb_serverless_cluster")- def test_returns_none_when_cluster_response_is_none(self, mock_get_cluster):- mock_get_cluster.return_value = None+ def test_returns_none_when_cluster_response_is_none(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(httpx.Response(200, content=b"null"))assert TidbService.fetch_qdrant_endpoint("url", "pub", "priv", "c-123") is None- @patch.object(TidbService, "get_tidb_serverless_cluster")- def test_returns_none_when_host_missing(self, mock_get_cluster):- mock_get_cluster.return_value = {"endpoints": {"public": {}}}+ def test_returns_none_when_host_missing(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(httpx.Response(200, json={"endpoints": {"public": {}}}))assert TidbService.fetch_qdrant_endpoint("url", "pub", "priv", "c-123") is None- @patch.object(TidbService, "get_tidb_serverless_cluster")- def test_returns_none_when_endpoints_missing(self, mock_get_cluster):- mock_get_cluster.return_value = {}+ def test_returns_none_when_endpoints_missing(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(httpx.Response(200, json={}))assert TidbService.fetch_qdrant_endpoint("url", "pub", "priv", "c-123") is None- @patch.object(TidbService, "get_tidb_serverless_cluster")- def test_returns_none_on_exception(self, mock_get_cluster):- mock_get_cluster.side_effect = RuntimeError("network error")+ def test_returns_none_on_exception(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(httpx.ConnectError("network error"))assert TidbService.fetch_qdrant_endpoint("url", "pub", "priv", "c-123") is Noneclass TestCreateTidbServerlessClusterQdrantEndpoint:"""Verify that create_tidb_serverless_cluster includes qdrant_endpoint in its result."""- @patch.object(TidbService, "get_tidb_serverless_cluster")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_result_contains_qdrant_endpoint(self, mock_config, mock_http, mock_get_cluster):- mock_config.TIDB_SPEND_LIMIT = 10- mock_http.post.return_value = MagicMock(status_code=200, json=lambda: {"clusterId": "c-1"})- mock_get_cluster.return_value = {- "state": "ACTIVE",- "userPrefix": "pfx",- "endpoints": {"public": {"host": "gw.tidbcloud.com", "port": 4000}},- }+ def test_result_contains_qdrant_endpoint(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(+ httpx.Response(200, json={"clusterId": "c-1"}),+ httpx.Response(+ 200,+ json={+ "state": "ACTIVE",+ "userPrefix": "pfx",+ "endpoints": {"public": {"host": "gw.tidbcloud.com", "port": 4000}},+ },+ ),+ )result = TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")assert result is not None+ assert result["account"] == "pfx.root"assert result["qdrant_endpoint"] == "https://qdrant-gw.tidbcloud.com"+ assert cloud_client.requests == [+ CloudRequest("POST", "url/clusters", KEYS),+ CloudRequest("GET", "url/clusters/c-1", KEYS),+ ]- @patch.object(TidbService, "get_tidb_serverless_cluster")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_result_qdrant_endpoint_none_when_no_endpoints(self, mock_config, mock_http, mock_get_cluster):- mock_config.TIDB_SPEND_LIMIT = 10- mock_http.post.return_value = MagicMock(status_code=200, json=lambda: {"clusterId": "c-1"})- mock_get_cluster.return_value = {"state": "ACTIVE", "userPrefix": "pfx"}+ def test_result_qdrant_endpoint_none_when_no_endpoints(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(+ httpx.Response(200, json={"clusterId": "c-1"}),+ httpx.Response(200, json={"state": "ACTIVE", "userPrefix": "pfx"}),+ )result = TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")@@ -98,19 +177,16 @@ class TestCreateTidbServerlessClusterQdrantEndpoint:class TestBatchCreateTidbServerlessClusterQdrantEndpoint:"""Verify that batch_create includes qdrant_endpoint per cluster."""- @patch.object(TidbService, "fetch_qdrant_endpoint", return_value="https://qdrant-gw.tidbcloud.com")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.redis_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_batch_result_contains_qdrant_endpoint(self, mock_config, mock_http, mock_redis, mock_fetch_ep):- mock_config.TIDB_SPEND_LIMIT = 10+ def test_batch_result_contains_qdrant_endpoint(+ self, cloud_client: FakeTidbCloudClient, monkeypatch: pytest.MonkeyPatch+ ) -> None:cluster_name = "abc123"- mock_http.post.return_value = MagicMock(- status_code=200,- json=lambda: {"clusters": [{"clusterId": "c-1", "displayName": cluster_name}]},+ fake_redis = FakeRedis({f"tidb_serverless_cluster_password:{cluster_name}": b"password123"})+ monkeypatch.setattr(tidb_service_module, "redis_client", fake_redis)+ cloud_client.queue(+ httpx.Response(200, json={"clusters": [{"clusterId": "c-1", "displayName": cluster_name}]}),+ httpx.Response(200, json={"endpoints": {"public": {"host": "gw.tidbcloud.com"}}}),)- mock_redis.setex = MagicMock()- mock_redis.get.return_value = b"password123"result = TidbService.batch_create_tidb_serverless_cluster(batch_size=1,@@ -122,71 +198,72 @@ class TestBatchCreateTidbServerlessClusterQdrantEndpoint:region="us-east-1",)- assert len(result) == 1- assert result[0]["qdrant_endpoint"] == "https://qdrant-gw.tidbcloud.com"+ assert result == [+ {+ "cluster_id": "c-1",+ "cluster_name": cluster_name,+ "account": "root",+ "password": "password123",+ "qdrant_endpoint": "https://qdrant-gw.tidbcloud.com",+ }+ ]+ assert [(seconds, len(password)) for _, seconds, password in fake_redis.setex_calls] == [(3600, 16)]+ assert cloud_client.requests == [+ CloudRequest("POST", "url/clusters:batchCreate", KEYS),+ CloudRequest("GET", "url/clusters/c-1", KEYS),+ ]class TestCreateTidbServerlessClusterRetry:"""Cover retry/logging paths in create_tidb_serverless_cluster."""- @patch.object(TidbService, "get_tidb_serverless_cluster")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_polls_until_active(self, mock_config, mock_http, mock_get_cluster):- mock_config.TIDB_SPEND_LIMIT = 10- mock_http.post.return_value = MagicMock(status_code=200, json=lambda: {"clusterId": "c-1"})- mock_get_cluster.side_effect = [- {"state": "CREATING", "userPrefix": ""},- {"state": "ACTIVE", "userPrefix": "pfx", "endpoints": {"public": {"host": "gw.tidb.com"}}},- ]+ def test_polls_until_active(self, cloud_client: FakeTidbCloudClient, sleeps: list[float]) -> None:+ cloud_client.queue(+ httpx.Response(200, json={"clusterId": "c-1"}),+ httpx.Response(200, json={"state": "CREATING", "userPrefix": ""}),+ httpx.Response(+ 200, json={"state": "ACTIVE", "userPrefix": "pfx", "endpoints": {"public": {"host": "gw.tidb.com"}}}+ ),+ )- with patch("dify_vdb_tidb_on_qdrant.tidb_service.time.sleep"):- result = TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")+ result = TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")assert result is not Noneassert result["qdrant_endpoint"] == "https://qdrant-gw.tidb.com"- assert mock_get_cluster.call_count == 2+ assert [request.url for request in cloud_client.requests] == [+ "url/clusters",+ "url/clusters/c-1",+ "url/clusters/c-1",+ ]+ assert sleeps == [30]- @patch.object(TidbService, "get_tidb_serverless_cluster")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_returns_none_after_max_retries(self, mock_config, mock_http, mock_get_cluster):- mock_config.TIDB_SPEND_LIMIT = 10- mock_http.post.return_value = MagicMock(status_code=200, json=lambda: {"clusterId": "c-1"})- mock_get_cluster.return_value = {"state": "CREATING", "userPrefix": ""}+ def test_returns_none_after_max_retries(self, cloud_client: FakeTidbCloudClient, sleeps: list[float]) -> None:+ cloud_client.queue(+ httpx.Response(200, json={"clusterId": "c-1"}),+ *[httpx.Response(200, json={"state": "CREATING", "userPrefix": ""}) for _ in range(30)],+ )- with patch("dify_vdb_tidb_on_qdrant.tidb_service.time.sleep"):- result = TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")+ result = TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")assert result is None+ assert len(cloud_client.requests) == 31+ assert sleeps == [30] * 30- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_raises_on_post_failure(self, mock_config, mock_http):- mock_config.TIDB_SPEND_LIMIT = 10- mock_response = MagicMock(status_code=400, text="Bad Request")- mock_response.raise_for_status.side_effect = Exception("HTTP 400")- mock_http.post.return_value = mock_response+ def test_raises_on_post_failure(self, cloud_client: FakeTidbCloudClient) -> None:+ cloud_client.queue(httpx.Response(400, text="Bad Request"))- with pytest.raises(Exception, match="HTTP 400"):+ with pytest.raises(httpx.HTTPStatusError, match="400 Bad Request"):TidbService.create_tidb_serverless_cluster("proj", "url", "iam", "pub", "priv", "us-east-1")class TestBatchCreateEdgeCases:"""Cover logging/edge-case branches in batch_create."""- @patch.object(TidbService, "fetch_qdrant_endpoint", return_value=None)- @patch("dify_vdb_tidb_on_qdrant.tidb_service.redis_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_skips_cluster_when_no_cached_password(self, mock_config, mock_http, mock_redis, mock_fetch_ep):- mock_config.TIDB_SPEND_LIMIT = 10- mock_http.post.return_value = MagicMock(- status_code=200,- json=lambda: {"clusters": [{"clusterId": "c-1", "displayName": "name1"}]},- )- mock_redis.setex = MagicMock()- mock_redis.get.return_value = None+ def test_skips_cluster_when_no_cached_password(+ self, cloud_client: FakeTidbCloudClient, monkeypatch: pytest.MonkeyPatch+ ) -> None:+ monkeypatch.setattr(tidb_service_module, "redis_client", FakeRedis())+ cloud_client.queue(httpx.Response(200, json={"clusters": [{"clusterId": "c-1", "displayName": "name1"}]}))result = TidbService.batch_create_tidb_serverless_cluster(batch_size=1,@@ -199,19 +276,14 @@ class TestBatchCreateEdgeCases:)assert len(result) == 0- mock_fetch_ep.assert_not_called()-- @patch("dify_vdb_tidb_on_qdrant.tidb_service.redis_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")- @patch("dify_vdb_tidb_on_qdrant.tidb_service.dify_config")- def test_raises_on_post_failure(self, mock_config, mock_http, mock_redis):- mock_config.TIDB_SPEND_LIMIT = 10- mock_response = MagicMock(status_code=500, text="Server Error")- mock_response.raise_for_status.side_effect = Exception("HTTP 500")- mock_http.post.return_value = mock_response- mock_redis.setex = MagicMock()-- with pytest.raises(Exception, match="HTTP 500"):+ # No Get Cluster request: the qdrant endpoint is not fetched for a skipped cluster.+ assert cloud_client.requests == [CloudRequest("POST", "url/clusters:batchCreate", KEYS)]++ def test_raises_on_post_failure(self, cloud_client: FakeTidbCloudClient, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(tidb_service_module, "redis_client", FakeRedis())+ cloud_client.queue(httpx.Response(500, text="Server Error"))++ with pytest.raises(httpx.HTTPStatusError, match="500 Internal Server Error"):TidbService.batch_create_tidb_serverless_cluster(batch_size=1,project_id="proj",@@ -242,27 +314,28 @@ def _persist_tidb_auth_binding(sqlite3_session: Session) -> TidbAuthBinding:class TestBatchUpdateTidbServerlessClusterStatus:"""Verify that status updates only expose clusters after qdrant endpoint is ready."""- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")def test_sets_active_when_batch_response_contains_endpoint(self,- mock_http,+ cloud_client: FakeTidbCloudClient,monkeypatch: pytest.MonkeyPatch,sqlite3_session: Session,- ):+ ) -> None:binding = _persist_tidb_auth_binding(sqlite3_session)monkeypatch.setattr(tidb_service_module.db, "session", sqlite3_session)- mock_http.get.return_value = MagicMock(- status_code=200,- json=lambda: {- "clusters": [- {- "clusterId": "c-1",- "state": "ACTIVE",- "userPrefix": "pfx",- "endpoints": {"public": {"host": "gw.tidbcloud.com"}},- }- ]- },+ cloud_client.queue(+ httpx.Response(+ 200,+ json={+ "clusters": [+ {+ "clusterId": "c-1",+ "state": "ACTIVE",+ "userPrefix": "pfx",+ "endpoints": {"public": {"host": "gw.tidbcloud.com"}},+ }+ ]+ },+ ))TidbService.batch_update_tidb_serverless_cluster_status([binding], "proj", "url", "iam", "pub", "priv")@@ -273,21 +346,24 @@ class TestBatchUpdateTidbServerlessClusterStatus:assert persisted.account == "pfx.root"assert persisted.qdrant_endpoint == "https://qdrant-gw.tidbcloud.com"assert persisted.status == TidbAuthBindingStatus.ACTIVE+ assert cloud_client.requests == [+ CloudRequest("GET", "url/clusters:batchGet", KEYS, {"clusterIds": ["c-1"], "view": "BASIC"})+ ]- @patch.object(TidbService, "fetch_qdrant_endpoint", return_value="https://qdrant-gw.tidbcloud.com")- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")def test_fetches_endpoint_when_batch_response_omits_it(self,- mock_http,- mock_fetch_endpoint,+ cloud_client: FakeTidbCloudClient,monkeypatch: pytest.MonkeyPatch,sqlite3_session: Session,- ):+ ) -> None:binding = _persist_tidb_auth_binding(sqlite3_session)monkeypatch.setattr(tidb_service_module.db, "session", sqlite3_session)- mock_http.get.return_value = MagicMock(- status_code=200,- json=lambda: {"clusters": [{"clusterId": "c-1", "state": "ACTIVE", "userPrefix": "pfx", "endpoints": {}}]},+ cloud_client.queue(+ httpx.Response(+ 200,+ json={"clusters": [{"clusterId": "c-1", "state": "ACTIVE", "userPrefix": "pfx", "endpoints": {}}]},+ ),+ httpx.Response(200, json={"endpoints": {"public": {"host": "gw.tidbcloud.com"}}}),)TidbService.batch_update_tidb_serverless_cluster_status([binding], "proj", "url", "iam", "pub", "priv")@@ -298,22 +374,22 @@ class TestBatchUpdateTidbServerlessClusterStatus:assert persisted.account == "pfx.root"assert persisted.qdrant_endpoint == "https://qdrant-gw.tidbcloud.com"assert persisted.status == TidbAuthBindingStatus.ACTIVE- mock_fetch_endpoint.assert_called_once_with("url", "pub", "priv", "c-1")+ assert cloud_client.requests[1:] == [CloudRequest("GET", "url/clusters/c-1", KEYS)]- @patch.object(TidbService, "fetch_qdrant_endpoint", return_value=None)- @patch("dify_vdb_tidb_on_qdrant.tidb_service._tidb_http_client")def test_keeps_creating_when_endpoint_is_not_ready(self,- mock_http,- mock_fetch_endpoint,+ cloud_client: FakeTidbCloudClient,monkeypatch: pytest.MonkeyPatch,sqlite3_session: Session,- ):+ ) -> None:binding = _persist_tidb_auth_binding(sqlite3_session)monkeypatch.setattr(tidb_service_module.db, "session", sqlite3_session)- mock_http.get.return_value = MagicMock(- status_code=200,- json=lambda: {"clusters": [{"clusterId": "c-1", "state": "ACTIVE", "userPrefix": "pfx", "endpoints": {}}]},+ cloud_client.queue(+ httpx.Response(+ 200,+ json={"clusters": [{"clusterId": "c-1", "state": "ACTIVE", "userPrefix": "pfx", "endpoints": {}}]},+ ),+ httpx.Response(200, json={"endpoints": {}}),)TidbService.batch_update_tidb_serverless_cluster_status([binding], "proj", "url", "iam", "pub", "priv")@@ -324,4 +400,4 @@ class TestBatchUpdateTidbServerlessClusterStatus:assert persisted.account == "pfx.root"assert persisted.qdrant_endpoint is Noneassert persisted.status == TidbAuthBindingStatus.CREATING- mock_fetch_endpoint.assert_called_once_with("url", "pub", "priv", "c-1")+ assert cloud_client.requests[1:] == [CloudRequest("GET", "url/clusters/c-1", KEYS)]