mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Add unix socket connection by url stirng. (#1511)
* add unix connectin by url string
This commit is contained in:
@ -66,6 +66,30 @@ func TestParseURL(t *testing.T) {
|
||||
0, false, nil,
|
||||
"foo", "bar",
|
||||
},
|
||||
{
|
||||
"unix:///tmp/redis.sock",
|
||||
"/tmp/redis.sock",
|
||||
0, false, nil,
|
||||
"", "",
|
||||
},
|
||||
{
|
||||
"unix://foo:bar@/tmp/redis.sock",
|
||||
"/tmp/redis.sock",
|
||||
0, false, nil,
|
||||
"foo", "bar",
|
||||
},
|
||||
{
|
||||
"unix://foo:bar@/tmp/redis.sock?db=3",
|
||||
"/tmp/redis.sock",
|
||||
3, false, nil,
|
||||
"foo", "bar",
|
||||
},
|
||||
{
|
||||
"unix://foo:bar@/tmp/redis.sock?db=test",
|
||||
"/tmp/redis.sock",
|
||||
0, false, errors.New("invalid reids database number: strconv.Atoi: parsing \"test\": invalid syntax"),
|
||||
"", "",
|
||||
},
|
||||
{
|
||||
"redis://localhost/?abc=123",
|
||||
"",
|
||||
|
Reference in New Issue
Block a user