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