|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class TestPubSubManager: |
7 | | - def test_sentinel_url_parser(self): |
| 7 | + @pytest.mark.parametrize('rtype', ['redis', 'valkey']) |
| 8 | + def test_sentinel_url_parser(self, rtype): |
8 | 9 | with pytest.raises(ValueError): |
9 | | - parse_redis_sentinel_url('redis://localhost:6379/0') |
| 10 | + parse_redis_sentinel_url(f'{rtype}://localhost:6379/0') |
10 | 11 |
|
11 | 12 | assert parse_redis_sentinel_url( |
12 | | - 'redis+sentinel://localhost:6379' |
| 13 | + f'{rtype}+sentinel://localhost:6379' |
13 | 14 | ) == ( |
14 | 15 | [('localhost', 6379)], |
15 | 16 | None, |
16 | 17 | {} |
17 | 18 | ) |
18 | 19 | assert parse_redis_sentinel_url( |
19 | | - 'redis+sentinel://192.168.0.1:6379,192.168.0.2:6379/' |
| 20 | + f'{rtype}+sentinel://192.168.0.1:6379,192.168.0.2:6379/' |
20 | 21 | ) == ( |
21 | 22 | [('192.168.0.1', 6379), ('192.168.0.2', 6379)], |
22 | 23 | None, |
23 | 24 | {} |
24 | 25 | ) |
25 | 26 | assert parse_redis_sentinel_url( |
26 | | - 'redis+sentinel://h1:6379,h2:6379/0' |
| 27 | + f'{rtype}+sentinel://h1:6379,h2:6379/0' |
27 | 28 | ) == ( |
28 | 29 | [('h1', 6379), ('h2', 6379)], |
29 | 30 | None, |
30 | 31 | {'db': 0} |
31 | 32 | ) |
32 | 33 | assert parse_redis_sentinel_url( |
33 | | - 'redis+sentinel://user:password@h1:6379,h2:6379,h1:6380/0/myredis' |
| 34 | + f'{rtype}+sentinel://user:password@h1:6379,h2:6379,h1:6380/0/myredis' |
34 | 35 | ) == ( |
35 | 36 | [('h1', 6379), ('h2', 6379), ('h1', 6380)], |
36 | 37 | 'myredis', |
|
0 commit comments