Skip to content

fix - fixing fragile test

5eaafcb
Select commit
Loading
Failed to load commit list.
Merged

fix - passing None as data account should be handled gracefully #44939

fix - fixing fragile test
5eaafcb
Select commit
Loading
Failed to load commit list.
Azure Pipelines / python - cosmos succeeded Feb 10, 2026 in 7d 0h 37m 42s

Build #20260203.3 had test failures

Details

Tests

  • Failed: 2 (0.02%, 2 new, 0 recurring)
  • Passed: 12,506 (99.15%)
  • Other: 105 (0.83%)
  • Total: 12,613

Annotations

Check failure on line 24 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - cosmos

Build log #L24

PowerShell exited with code '1'.

Check failure on line 1 in test_service_request_retry_policy

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - cosmos

test_service_request_retry_policy

assert 1 == 3
 +  where 1 = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x000001DC47DC0340>.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: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\whl\lib\site-packages\azure\core\tracing\decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
.tox\whl\lib\site-packages\azure\cosmos\container.py:292: in read_item
    return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
.tox\whl\lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1486: in ReadItem
    return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
.tox\whl\lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2911: in Read
    result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
.tox\whl\lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2981: in __Get
    return synchronized_request.SynchronizedRequest(
.tox\whl\lib\site-packages\azure\cosmos\_synchronized_request.py:236: in SynchronizedRequest
    return _retry_utility.Execute(
.tox\whl\lib\site-packages\azure\cosmos\_retry_utility.py:261: in Execute
    _handle_service_request_retries(client, service_request_retry_policy, e, *args)
.tox\whl\lib\site-packages\azure\cosmos\_retry_utility.py:304: in _handle_service_request_retries
    raise exception
.tox\whl\lib\site-packages\azure\cosmos\_retry_utility.py:129: in Execute
    result = ExecuteFunction(function, global_endpoint_manager, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x000001DC47DC0340>
func = <function _Request at 0x000001DC45E216C0>
args = (<azure.cosmos._global_partition_endpoint_manager_circuit_breaker._GlobalPartitionEndpointManagerForCircuitBreaker obj...4/colls/SinglePartitionTestContainer-0d2b0367-1610-4494-8ba9-79f0923fd8ac/docs/14dcd0d9-061e-4193-8767-5918c745ab43/'>)
kwargs = {}
request_obj = <azure.cosmos._request_object.RequestObject object at 0x000001DC00842320>
exception = ServiceRequestError('mock exception')

    def

Check failure on line 1 in test_service_request_retry_policy

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - cosmos

test_service_request_retry_policy

assert 1 == 3
 +  where 1 = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x00000237C88323D0>.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: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\mindependency\lib\site-packages\azure\core\tracing\decorator.py:78: in wrapper_use_tracer
    return func(*args, **kwargs)
.tox\mindependency\lib\site-packages\azure\cosmos\container.py:292: in read_item
    return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
.tox\mindependency\lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1486: in ReadItem
    return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
.tox\mindependency\lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2911: in Read
    result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
.tox\mindependency\lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2981: in __Get
    return synchronized_request.SynchronizedRequest(
.tox\mindependency\lib\site-packages\azure\cosmos\_synchronized_request.py:236: in SynchronizedRequest
    return _retry_utility.Execute(
.tox\mindependency\lib\site-packages\azure\cosmos\_retry_utility.py:261: in Execute
    _handle_service_request_retries(client, service_request_retry_policy, e, *args)
.tox\mindependency\lib\site-packages\azure\cosmos\_retry_utility.py:304: in _handle_service_request_retries
    raise exception
.tox\mindependency\lib\site-packages\azure\cosmos\_retry_utility.py:129: in Execute
    result = ExecuteFunction(function, global_endpoint_manager, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x00000237C88323D0>
func = <function _Request at 0x00000237950385E0>
args = (<azure.cosmos._global_partition_endpoint_manager_circuit_breaker._GlobalPartitionEndpointManagerForCircuitBreaker obj...b/colls/SinglePartitionTestContainer-7e0a3208-0654-4bfe-bece-926b6e06482f/docs/9b92c5f8-7372-4b9c-b601-09eb378e9125/'>)
kwargs = {}
request_obj = <azure.cosmos._request_object.RequestObject