(t *testing.T)
| 21 | ) |
| 22 | |
| 23 | func TestReplicationSet_GetAddresses(t *testing.T) { |
| 24 | tests := map[string]struct { |
| 25 | rs ReplicationSet |
| 26 | expected []string |
| 27 | }{ |
| 28 | "should return an empty slice on empty replication set": { |
| 29 | rs: ReplicationSet{}, |
| 30 | expected: []string{}, |
| 31 | }, |
| 32 | "should return instances addresses (no order guaranteed)": { |
| 33 | rs: ReplicationSet{ |
| 34 | Instances: []InstanceDesc{ |
| 35 | {Addr: "127.0.0.1"}, |
| 36 | {Addr: "127.0.0.2"}, |
| 37 | {Addr: "127.0.0.3"}, |
| 38 | }, |
| 39 | }, |
| 40 | expected: []string{"127.0.0.1", "127.0.0.2", "127.0.0.3"}, |
| 41 | }, |
| 42 | } |
| 43 | |
| 44 | for testName, testData := range tests { |
| 45 | t.Run(testName, func(t *testing.T) { |
| 46 | assert.ElementsMatch(t, testData.expected, testData.rs.GetAddresses()) |
| 47 | }) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func TestReplicationSet_GetAddressesWithout(t *testing.T) { |
| 52 | tests := map[string]struct { |
nothing calls this directly
no test coverage detected