test(redis): cover a backslash in list_sessions glob escaping - #7216
Open
vishal-bulbule wants to merge 1 commit into
Open
vishal-bulbule wants to merge 1 commit into
vishal-bulbule wants to merge 1 commit into
Conversation
_escape_glob escapes the backslash along with *, ?, [ and ], but the test that list_sessions matches app and user IDs literally had no backslash case. Add one, which also covers user IDs such as CORP\alice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
This is the follow-up test a maintainer asked for in
#6956:
"the backslash case still isn't covered, so that test is worth sending on its own."
Problem:
4b26bba made
RedisSessionService.list_sessionsmatchapp_nameanduser_idliterally byescaping Redis glob metacharacters.
_escape_globescapes the backslash along with*,?,[and], buttest_list_sessions_glob_metacharacters_match_literallyhad no backslashcase. User IDs such as
CORP\alicedepend on it.Solution:
Add a backslash case to the existing test's table in
tests/unittests/integrations/redis/test_redis_session_service.py. Test-only change.Testing Plan
Unit Tests:
The new case passes on
main, and fails if the backslash is removed from_escape_glob(checked by temporarily editing the regex):
The one failing test below,
test_import_loading.py::test_entry_point_loads_only_allowlisted_packages[agent],also fails on
main(d57c84f) and is unrelated to this change; #7214 fixes it.Manual End-to-End (E2E) Tests:
N/A, test-only change.
Checklist