Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ServiceBus] fix receive_messages receive and delete bug #31833

Closed

update changelog

2fee9fc
Select commit
Loading
Failed to load commit list.
Closed

[ServiceBus] fix receive_messages receive and delete bug #31833

update changelog
2fee9fc
Select commit
Loading
Failed to load commit list.
Azure Pipelines / python - servicebus - ci failed Aug 29, 2023 in 21m 18s

Build #20230829.3 had test failures

Details

Tests

  • Failed: 1 (0.02%)
  • Passed: 1,849 (28.98%)
  • Other: 4,530 (71.00%)
  • Total: 6,380
Code coverage

  • 8927 of 57840 lines covered (15.43%)

Annotations

Check failure on line 2717 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - servicebus - ci

Build log #L2717

The process 'C:\hostedtoolcache\windows\Python\3.7.16\x64\python.exe' failed with exit code 1

Check failure on line 31 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - servicebus - 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 1 in test_async_queue_mock_auto_lock_renew_callback

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - servicebus - ci

test_async_queue_mock_auto_lock_renew_callback

IndexError: list index out of range
Raw output
self = <test_queues_async.TestServiceBusQueueAsync object at 0x0000016D157DB608>

    @AzureTestCase.await_prepared_test
    async def test_async_queue_mock_auto_lock_renew_callback(self):
        # A warning to future devs: If the renew period override heuristic in registration
        # ever changes, it may break this (since it adjusts renew period if it is not short enough)
    
        results = []
        errors = []
        async def callback_mock(renewable, error):
            results.append(renewable)
            if error:
                errors.append(error)
    
        receiver = MockReceiver()
        auto_lock_renew = AutoLockRenewer()
        with pytest.raises(TypeError):
            auto_lock_renew.register(receiver, renewable=Exception())  # an arbitrary invalid type.
    
        auto_lock_renew = AutoLockRenewer()
        auto_lock_renew._renew_period = 1  # So we can run the test fast.
        async with auto_lock_renew:  # Check that it is called when the object expires for any reason (silent renew failure)
            message = MockReceivedMessage(prevent_renew_lock=True)
            auto_lock_renew.register(receiver, renewable=message, on_lock_renew_failure=callback_mock)
            await asyncio.sleep(3)
            assert len(results) == 1 and results[-1]._lock_expired == True
            assert not errors
    
        del results[:]
        del errors[:]
        auto_lock_renew = AutoLockRenewer()
        auto_lock_renew._renew_period = 1
        async with auto_lock_renew:  # Check that in normal operation it does not get called
            auto_lock_renew.register(receiver, renewable=MockReceivedMessage(), on_lock_renew_failure=callback_mock)
            await asyncio.sleep(3)
            assert not results
            assert not errors
    
        del results[:]
        del errors[:]
        auto_lock_renew = AutoLockRenewer()
        auto_lock_renew._renew_period = 1
        async with auto_lock_renew:  # Check that when a message is settled, it will not get called even after expiry
            message = MockReceivedMessage(prevent_renew_lock=True)
            auto_lock_renew.register(receiver, renewable=message, on_lock_renew_failure=callback_mock)
            message._settled = True
            await asyncio.sleep(3)
            assert not results
            assert not errors
    
        del results[:]
        del errors[:]
        auto_lock_renew = AutoLockRenewer()
        auto_lock_renew._renew_period = 1
        async with auto_lock_renew: # Check that it is called when there is an overt renew failure
            message = MockReceivedMessage(exception_on_renew_lock=True)
            auto_lock_renew.register(receiver, renewable=message, on_lock_renew_failure=callback_mock)
            await asyncio.sleep(3)
            assert len(results) == 1 and results[-1]._lock_expired == True
>           assert errors[-1]
E           IndexError: list index out of range

tests\async_tests\test_queues_async.py:1748: IndexError