renaming from TestParseFailoverURL to TestParseSentinelURL to be easier to find Failed tests in the test output
(t *testing.T)
| 422 | // renaming from TestParseFailoverURL to TestParseSentinelURL |
| 423 | // to be easier to find Failed tests in the test output |
| 424 | func TestParseSentinelURL(t *testing.T) { |
| 425 | cases := []struct { |
| 426 | url string |
| 427 | o *redis.FailoverOptions |
| 428 | err error |
| 429 | }{ |
| 430 | { |
| 431 | url: "redis://localhost:6379?master_name=test", |
| 432 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6379"}, MasterName: "test"}, |
| 433 | }, |
| 434 | { |
| 435 | url: "redis://localhost:6379/5?master_name=test", |
| 436 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6379"}, MasterName: "test", DB: 5}, |
| 437 | }, |
| 438 | { |
| 439 | url: "rediss://localhost:6379/5?master_name=test", |
| 440 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6379"}, MasterName: "test", DB: 5, |
| 441 | TLSConfig: &tls.Config{ |
| 442 | ServerName: "localhost", |
| 443 | }}, |
| 444 | }, |
| 445 | { |
| 446 | url: "rediss://localhost:6379/5?master_name=test&skip_verify=true", |
| 447 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6379"}, MasterName: "test", DB: 5, |
| 448 | TLSConfig: &tls.Config{ |
| 449 | ServerName: "localhost", |
| 450 | InsecureSkipVerify: true, |
| 451 | }}, |
| 452 | }, |
| 453 | { |
| 454 | url: "redis://localhost:6379/5?master_name=test&db=2", |
| 455 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6379"}, MasterName: "test", DB: 2}, |
| 456 | }, |
| 457 | { |
| 458 | url: "redis://localhost:6379/5?addr=localhost:6380&addr=localhost:6381", |
| 459 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6380", "localhost:6379", "localhost:6381"}, DB: 5}, |
| 460 | }, |
| 461 | { |
| 462 | url: "redis://foo:bar@localhost:6379/5?addr=localhost:6380", |
| 463 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6380", "localhost:6379"}, |
| 464 | SentinelUsername: "foo", SentinelPassword: "bar", DB: 5}, |
| 465 | }, |
| 466 | { |
| 467 | url: "redis://:bar@localhost:6379/5?addr=localhost:6380", |
| 468 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6380", "localhost:6379"}, |
| 469 | SentinelUsername: "", SentinelPassword: "bar", DB: 5}, |
| 470 | }, |
| 471 | { |
| 472 | url: "redis://foo@localhost:6379/5?addr=localhost:6380", |
| 473 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6380", "localhost:6379"}, |
| 474 | SentinelUsername: "foo", SentinelPassword: "", DB: 5}, |
| 475 | }, |
| 476 | { |
| 477 | url: "redis://foo:bar@localhost:6379/5?addr=localhost:6380&dial_timeout=3", |
| 478 | o: &redis.FailoverOptions{SentinelAddrs: []string{"localhost:6380", "localhost:6379"}, |
| 479 | SentinelUsername: "foo", SentinelPassword: "bar", DB: 5, DialTimeout: 3 * time.Second}, |
| 480 | }, |
| 481 | { |
nothing calls this directly
no test coverage detected