Skip to content

[Identity] Add async credential concurrency control

1a4bd00
Select commit
Loading
Failed to load commit list.
Draft

Add async credential concurrency control #47171

[Identity] Add async credential concurrency control
1a4bd00
Select commit
Loading
Failed to load commit list.
Azure Pipelines / python - pullrequest failed May 27, 2026 in 18m 58s

Build #20260527.53 had test failures

Details

Tests

  • Failed: 3 (0.01%)
  • Passed: 38,692 (95.15%)
  • Other: 1,969 (4.84%)
  • Total: 40,664

Annotations

Check failure on line 69375 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L69375

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 6789 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L6789

PowerShell exited with code '1'.

Check failure on line 294 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L294

The process '/mnt/vss/_work/1/s/venv/bin/python' failed with exit code 4

Check failure on line 1 in test_asyncio_run_loop_cleanup

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_asyncio_run_loop_cleanup

assert 1 == 0
 +  where 1 = len(<WeakKeyDictionary at 0x38466608>)
 +    where <WeakKeyDictionary at 0x38466608> = <test_get_token_mixin_async.MockCredential object at 0x00000000384665d0>._locks
Raw output
def test_asyncio_run_loop_cleanup():
        """After asyncio.run() completes, the internally-created event loop should not be
        retained in _locks because WeakKeyDictionary drops keys with no strong references."""
        credential = MockCredential()
    
        async def use_credential():
            token = await credential.get_token(SCOPE)
            assert token.token == MockCredential.NEW_TOKEN.token
            # While running, the current loop should have a locks entry
            assert len(credential._locks) >= 1
    
        asyncio.run(use_credential())
    
        # The loop created by asyncio.run() is now closed and unreferenced
        gc.collect()
    
        # All loop entries should have been cleaned up
>       assert len(credential._locks) == 0
E       assert 1 == 0
E        +  where 1 = len(<WeakKeyDictionary at 0x38466608>)
E        +    where <WeakKeyDictionary at 0x38466608> = <test_get_token_mixin_async.MockCredential object at 0x00000000384665d0>._locks

tests/test_get_token_mixin_async.py:398: AssertionError

Check failure on line 1 in test_asyncio_run_loop_cleanup

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_asyncio_run_loop_cleanup

assert 1 == 0
 +  where 1 = len(<WeakKeyDictionary at 0x3ffabe18>)
 +    where <WeakKeyDictionary at 0x3ffabe18> = <test_get_token_mixin_async.MockCredential object at 0x000000003ffaa9c0>._locks
Raw output
def test_asyncio_run_loop_cleanup():
        """After asyncio.run() completes, the internally-created event loop should not be
        retained in _locks because WeakKeyDictionary drops keys with no strong references."""
        credential = MockCredential()
    
        async def use_credential():
            token = await credential.get_token(SCOPE)
            assert token.token == MockCredential.NEW_TOKEN.token
            # While running, the current loop should have a locks entry
            assert len(credential._locks) >= 1
    
        asyncio.run(use_credential())
    
        # The loop created by asyncio.run() is now closed and unreferenced
        gc.collect()
    
        # All loop entries should have been cleaned up
>       assert len(credential._locks) == 0
E       assert 1 == 0
E        +  where 1 = len(<WeakKeyDictionary at 0x3ffabe18>)
E        +    where <WeakKeyDictionary at 0x3ffabe18> = <test_get_token_mixin_async.MockCredential object at 0x000000003ffaa9c0>._locks

tests/test_get_token_mixin_async.py:398: AssertionError

Check failure on line 1 in test_asyncio_run_loop_cleanup

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_asyncio_run_loop_cleanup

assert 1 == 0
 +  where 1 = len(<WeakKeyDictionary at 0x14b3acd0>)
 +    where <WeakKeyDictionary at 0x14b3acd0> = <test_get_token_mixin_async.MockCredential object at 0x0000000014b3ac98>._locks
Raw output
def test_asyncio_run_loop_cleanup():
        """After asyncio.run() completes, the internally-created event loop should not be
        retained in _locks because WeakKeyDictionary drops keys with no strong references."""
        credential = MockCredential()
    
        async def use_credential():
            token = await credential.get_token(SCOPE)
            assert token.token == MockCredential.NEW_TOKEN.token
            # While running, the current loop should have a locks entry
            assert len(credential._locks) >= 1
    
        asyncio.run(use_credential())
    
        # The loop created by asyncio.run() is now closed and unreferenced
        gc.collect()
    
        # All loop entries should have been cleaned up
>       assert len(credential._locks) == 0
E       assert 1 == 0
E        +  where 1 = len(<WeakKeyDictionary at 0x14b3acd0>)
E        +    where <WeakKeyDictionary at 0x14b3acd0> = <test_get_token_mixin_async.MockCredential object at 0x0000000014b3ac98>._locks

tests/test_get_token_mixin_async.py:398: AssertionError