Skip to content

test:Dragonfly#373

Open
cunla wants to merge 45 commits intomasterfrom
dragonfly-tests
Open

test:Dragonfly#373
cunla wants to merge 45 commits intomasterfrom
dragonfly-tests

Conversation

@cunla
Copy link
Copy Markdown
Owner

@cunla cunla commented Apr 16, 2025

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

Coverage report:

Name                                                    Stmts   Miss Branch BrPart  Cover
-----------------------------------------------------------------------------------------
fakeredis/__init__.py                                      22      5      2      1    75%
fakeredis/_basefakesocket.py                              263     11     94     10    94%
fakeredis/_command_args_parsing.py                         71      2     42      2    96%
fakeredis/_commands.py                                    301     13     96      9    94%
fakeredis/_connection.py                                   94     10     30      7    86%
fakeredis/_fakesocket.py                                   10      0      0      0   100%
fakeredis/_helpers.py                                     172      5     60      3    97%
fakeredis/_msgs.py                                        106      0      0      0   100%
fakeredis/_server.py                                       69      5     16      3    91%
fakeredis/_tcp_server.py                                   95     14     34     12    78%
fakeredis/_valkey.py                                       36     16      4      1    52%
fakeredis/aioredis.py                                     152     14     40      8    88%
fakeredis/commands_mixins/__init__.py                      22      5      0      0    77%
fakeredis/commands_mixins/acl_mixin.py                    164     15     66     11    89%
fakeredis/commands_mixins/bitmap_mixin.py                 204      6     96      4    97%
fakeredis/commands_mixins/connection_mixin.py              68     15     14      1    73%
fakeredis/commands_mixins/generic_mixin.py                268     56    106     12    75%
fakeredis/commands_mixins/geo_mixin.py                    148     11     52      5    89%
fakeredis/commands_mixins/hash_mixin.py                   258     58     80      4    73%
fakeredis/commands_mixins/list_mixin.py                   245      8     96      8    95%
fakeredis/commands_mixins/pubsub_mixin.py                 119      7     36      8    88%
fakeredis/commands_mixins/scripting_mixin.py              175      7     68      7    94%
fakeredis/commands_mixins/server_mixin.py                  68      4     10      2    92%
fakeredis/commands_mixins/set_mixin.py                    145     12     38      6    88%
fakeredis/commands_mixins/sortedset_mixin.py              429     15    150     15    95%
fakeredis/commands_mixins/streams_mixin.py                258     28    116     29    85%
fakeredis/commands_mixins/string_mixin.py                 235      9    100     10    94%
fakeredis/commands_mixins/transactions_mixin.py            74      2     20      1    97%
fakeredis/geo/__init__.py                                   3      0      0      0   100%
fakeredis/geo/geohash.py                                   45      0     18      0   100%
fakeredis/geo/haversine.py                                 10      0      0      0   100%
fakeredis/model/__init__.py                                 9      0      0      0   100%
fakeredis/model/_acl.py                                   256     15     78     12    92%
fakeredis/model/_command_info.py                           46      3     24      4    90%
fakeredis/model/_expiring_members_set.py                   66     15     12      2    76%
fakeredis/model/_hash.py                                   70      4     10      0    95%
fakeredis/model/_stream.py                                326     14    110     11    94%
fakeredis/model/_timeseries_model.py                      173     13     70      4    91%
fakeredis/model/_topk.py                                   85      5     28      4    90%
fakeredis/model/_zset.py                                   68      0     14      0   100%
fakeredis/server_specific_commands/__init__.py              2      0      0      0   100%
fakeredis/server_specific_commands/dragonfly_mixin.py      19     10      2      0    43%
fakeredis/stack/__init__.py                                27     14      4      0    42%
fakeredis/stack/_bf_mixin.py                              122     18     48      9    78%
fakeredis/stack/_cf_mixin.py                              132     27     38      9    75%
fakeredis/stack/_cms_mixin.py                              79      0     38      0   100%
fakeredis/stack/_json_mixin.py                            328     12    114      9    95%
fakeredis/stack/_tdigest_mixin.py                         173     32     90     29    77%
fakeredis/stack/_timeseries_mixin.py                      337     45    168     33    83%
fakeredis/stack/_topk_mixin.py                             77     15     34     15    73%
-----------------------------------------------------------------------------------------
TOTAL                                                    6724    595   2366    320    89%

Copilot AI review requested due to automatic review settings December 16, 2025 19:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive Dragonfly server support to the test suite, including test exclusions, Dragonfly-specific test files, and implementation fixes for Dragonfly-specific behavior differences.

  • Adds Dragonfly-specific bitmap command tests in a new dedicated test file
  • Updates test markers to exclude Dragonfly from tests that aren't compatible and enables previously skipped tests now passing on Dragonfly
  • Implements Dragonfly-specific error handling and behavior differences in the fakeredis implementation
  • Modifies CI workflow to run Dragonfly tests on PRs while temporarily disabling standard tests on PRs

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/workflows/test.yml Disables pull_request trigger for main test workflow
.github/workflows/test-dragonfly.yml Enables pull_request trigger and adds hypothesis tests to Dragonfly CI
test/test_mixins/test_string_commands.py Reduces setrange offset test value from 501970112 to 50197112
test/test_mixins/test_sortedset_commands.py Removes unsupported_server_types markers for tests now passing on Dragonfly, updates TODO comments
test/test_mixins/test_scripting.py Consolidates Redis/Valkey Lua bool argument tests into single test with multi-server error message handling
test/test_mixins/test_geo_commands.py Reformats multi-line tuples to single-line for consistency
test/test_mixins/test_bitmap_commands_dragonfly.py Adds comprehensive Dragonfly-specific bitmap command tests (new file)
test/test_mixins/test_bitmap_commands.py Adds dragonfly exclusion marker to existing bitmap tests
test/test_mixins/test_acl_commands.py Adds dragonfly exclusion marker to ACL tests
test/test_json/test_json_arr_commands.py Reformats multi-line dictionary literals to single-line
test/test_json/test_json.py Reformats multi-line dictionary literals to single-line
test/test_hypothesis/test_server.py Adds dragonfly command strategy, renames redis-only strategy
test/test_hypothesis/test_hash.py Adds dragonfly-specific command strategy for hash commands
test/test_hypothesis/base.py Adds dragonfly command strategy integration to base test class
fakeredis/stack/_json_mixin.py Adds Dragonfly-specific error message for missing keys in JSON.STRLEN
fakeredis/commands_mixins/bitmap_mixin.py Adds Dragonfly-specific behavior for empty bitfield commands

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +10
# pull_request:
# branches:
# - master
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

Commenting out the pull_request trigger for the main test workflow effectively disables it for pull requests. This means that the main unit tests (which cover redis and valkey) will no longer run on pull requests, only on pushes to master. This is likely unintentional and will reduce test coverage for PRs. If this was intentional to focus on dragonfly testing during this development phase, it should be temporary and clearly documented.

Copilot uses AI. Check for mistakes.
Comment on lines +323 to +324
for m in (msgs.LUA_COMMAND_ARG_MSG6, msgs.LUA_COMMAND_ARG_MSG, msgs.VALKEY_LUA_COMMAND_ARG_MSG):
count += m[4:] in str(exc_info.value)
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The logic here uses string slicing m[4:] to skip the "ERR " prefix and then checks if that substring appears in the error message. However, this approach has issues:

  1. The VALKEY_LUA_COMMAND_ARG_MSG does not start with "ERR ", so slicing [4:] removes the first 4 characters ("Comm") instead of the expected prefix, making the match check incorrect.
  2. Using substring matching with in can lead to false positives if part of the message appears elsewhere in the error.

A more robust approach would be to check if the full error message matches any of the expected messages, possibly after normalizing both by removing common prefixes.

Copilot uses AI. Check for mistakes.
| commands(st.just("save"))
)
command_strategy_redis_only = commands(st.sampled_from(["flushdb", "flushall"]), st.sampled_from([[], "async"]))
command_strategy_dragonfly = commands(st.sampled_from(["flushdb", "flushall"]))
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The variable is named command_strategy_dragonfly but it's actually used for commands that work on dragonfly. For consistency with the naming pattern used for command_strategy_redis7 and command_strategy_redis_only, consider renaming to command_strategy_dragonfly_only if these commands are dragonfly-exclusive, or providing a clearer name that indicates what distinguishes these commands.

Copilot uses AI. Check for mistakes.
)


# TODO fix
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The TODO comment "fix" is too vague. It should explain what needs to be fixed about this test. Based on the context, this appears to be a working test for Dragonfly, so it's unclear what the TODO refers to. Either clarify the TODO or remove it if the test is working as expected.

Copilot uses AI. Check for mistakes.
Comment on lines +238 to +239
if len(args) == 0 and self._server.server_type == "dragonfly":
raise SimpleError(msgs.WRONG_ARGS_MSG6.format("bitfield"))
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

This check for empty args only applies to Dragonfly and raises an error before processing begins. However, line 274-275 handles the case where results is empty at the end, also only for Dragonfly. This creates inconsistent behavior: if args is empty, we raise an error (line 238-239), but if args contains only "OVERFLOW" commands with no actual operations (which would also result in empty results), we return None (line 274-275). Consider consolidating this logic or clarifying when an error should be raised vs when None should be returned.

Copilot uses AI. Check for mistakes.
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.

2 participants