Add partition key hash baseline tests for Cosmos DB Python SDK #45136
Azure Pipelines / python - cosmos - ci
failed
Mar 10, 2026 in 47m 58s
Build #20260310.7 had test failures
Details
- Failed: 1 (0.01%)
- Passed: 8,411 (99.28%)
- Other: 60 (0.71%)
- Total: 8,472
Annotations
Check failure on line 31 in Build log
azure-pipelines / python - cosmos - ci
Build log #L31
There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.
Check failure on line 4614 in Build log
azure-pipelines / python - cosmos - ci
Build log #L4614
PowerShell exited with code '1'.
Check failure on line 1 in test_service_request_retry_policy
azure-pipelines / python - cosmos - ci
test_service_request_retry_policy
assert 1 == 3
+ where 1 = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x0000023FB1B27DD0>.counter
Raw output
self = <test_service_retry_policies.TestServiceRetryPolicies testMethod=test_service_request_retry_policy>
def test_service_request_retry_policy(self):
mock_client = CosmosClient(self.host, self.masterKey)
db = mock_client.get_database_client(self.TEST_DATABASE_ID)
container = db.get_container_client(self.TEST_CONTAINER_ID)
created_item = container.create_item({"id": str(uuid.uuid4()), "pk": str(uuid.uuid4())})
# Save the original function
self.original_execute_function = _retry_utility.ExecuteFunction
# Change the location cache to have 3 preferred read regions and 3 available read endpoints by location
original_location_cache = mock_client.client_connection._global_endpoint_manager.location_cache
original_location_cache.account_read_locations = [self.REGION1, self.REGION2, self.REGION3]
original_location_cache.available_read_regional_endpoints_by_locations = {self.REGION1: self.REGIONAL_ENDPOINT,
self.REGION2: self.REGIONAL_ENDPOINT,
self.REGION3: self.REGIONAL_ENDPOINT}
original_location_cache.read_regional_routing_contexts = [self.REGIONAL_ENDPOINT, self.REGIONAL_ENDPOINT,
self.REGIONAL_ENDPOINT]
expected_counter = len(original_location_cache.read_regional_routing_contexts)
try:
# Mock the function to return the ServiceRequestException we retry
mf = self.MockExecuteServiceRequestExceptionIgnoreQuery(self.original_execute_function)
_retry_utility.ExecuteFunction = mf
> container.read_item(created_item['id'], created_item['pk'])
tests\test_service_retry_policies.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\core\tracing\decorator.py:119: in wrapper_use_tracer
return func(*args, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\container.py:301: in read_item
return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1504: in ReadItem
return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2948: in Read
result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:3020: in __Get
return synchronized_request.SynchronizedRequest(
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_synchronized_request.py:288: in SynchronizedRequest
return _retry_utility.Execute(
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_retry_utility.py:278: in Execute
_handle_service_request_retries(client, service_request_retry_policy, e, *args)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_retry_utility.py:342: in _handle_service_request_retries
raise exception
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_retry_utility.py:138: in Execute
result = ExecuteFunction(function, global_endpoint_manager, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x0000023FB1B27DD0>
func = <function _Request at 0x0000023FAF131800>
args = (<azure.cosmos._global_partition_endpoint_manager_per_partition_automatic_failover._GlobalPartitionEndpointManagerForP..
Loading