Skip to content

Conversation

@vvlrff
Copy link
Contributor

@vvlrff vvlrff commented Dec 8, 2025

Description

Add comprehensive tests to verify correct method selection in Redis stream subscribers:

  • Test XAUTOCLAIM usage when min_idle_time is set
  • Test XREADGROUP usage when min_idle_time is not set
  • Cover batch mode, get_one(), and iterator scenarios
  • Verify method calls are tracked correctly for different configurations

Fixes #2678

Type of change

Please delete options that are not relevant.

  • Bug fix (a non-breaking change that resolves an issue)

Checklist

  • My code adheres to the style guidelines of this project (just lint shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running just test-coverage
  • I have ensured that static analysis tests are passing by running just static-analysis
  • I have included code examples to illustrate the modifications

…n min_idle_time

Add comprehensive tests to verify correct method selection in Redis stream subscribers:
- Test XAUTOCLAIM usage when min_idle_time is set
- Test XREADGROUP usage when min_idle_time is not set
- Cover batch mode, get_one(), and iterator scenarios
- Verify method calls are tracked correctly for different configurations
- Consolidated assertion statements for clarity and consistency.
- Improved readability by removing unnecessary list comprehensions.
- Ensured that test logic remains intact while enhancing code maintainability.
@vvlrff vvlrff requested a review from Lancetnik as a code owner December 8, 2025 19:28
@CLAassistant
Copy link

CLAassistant commented Dec 8, 2025

CLA assistant check
All committers have signed the CLA.

- Replaced manual tracking of method calls with `unittest.mock.patch` for `xautoclaim` and `xreadgroup`.
- Improved test clarity and maintainability by using a spy decorator to verify method calls.
- Ensured correct method selection based on `min_idle_time` across various test scenarios.
mock.assert_any_call("second_pass_msg0")

@pytest.mark.slow()
async def test_min_idle_time_uses_xautoclaim(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this test?

- Removed redundant event initialization within test methods, passing it as a parameter instead.
- Improved test structure by consolidating method calls and assertions for clarity.
- Verified that XAUTOCLAIM is used correctly based on min_idle_time settings across various scenarios.
@Lancetnik Lancetnik enabled auto-merge December 10, 2025 21:27
@Lancetnik Lancetnik added this pull request to the merge queue Dec 10, 2025
Merged via the queue into ag2ai:main with commit 0904d3d Dec 10, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: min_idle_time ignored when group and consumer are specified

3 participants