|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
| 3 | +require 'uri' |
3 | 4 | require 'testing_helper'
|
4 | 5 |
|
5 | 6 | class RedisClient
|
@@ -98,7 +99,10 @@ def test_build_node_configs
|
98 | 99 | { addrs: %w[redis://127.0.0.1:6379 redis://127.0.0.2:6380], want: [{ host: '127.0.0.1', port: 6379 }, { host: '127.0.0.2', port: 6380 }] },
|
99 | 100 | { addrs: %w[rediss://foo:[email protected]:6379], want: [{ ssl: true, username: 'foo', password: 'bar', host: '127.0.0.1', port: 6379 }] },
|
100 | 101 | { addrs: %w[redis://[email protected]:6379], want: [{ host: '127.0.0.1', port: 6379, username: 'foo' }] },
|
| 102 | + { addrs: %w[redis://foo:@127.0.0.1:6379], want: [{ host: '127.0.0.1', port: 6379, username: 'foo' }] }, |
101 | 103 | { addrs: %w[redis://:[email protected]:6379], want: [{ host: '127.0.0.1', port: 6379, password: 'bar' }] },
|
| 104 | + { addrs: %W[redis://#{URI.encode_www_form_component('!&<123-abc>')}:@127.0.0.1:6379], want: [{ host: '127.0.0.1', port: 6379, username: '!&<123-abc>' }] }, |
| 105 | + { addrs: %W[redis://:#{URI.encode_www_form_component('!&<123-abc>')}@127.0.0.1:6379], want: [{ host: '127.0.0.1', port: 6379, password: '!&<123-abc>' }] }, |
102 | 106 | { addrs: [{ host: '127.0.0.1', port: 6379 }], want: [{ host: '127.0.0.1', port: 6379 }] },
|
103 | 107 | { addrs: [{ host: '127.0.0.1', port: 6379 }, { host: '127.0.0.2', port: '6380' }], want: [{ host: '127.0.0.1', port: 6379 }, { host: '127.0.0.2', port: 6380 }] },
|
104 | 108 | { addrs: [{ host: '127.0.0.1', port: 6379, username: 'foo', password: 'bar', ssl: true }], want: [{ ssl: true, username: 'foo', password: 'bar', host: '127.0.0.1', port: 6379 }] },
|
|
0 commit comments