MCPcopy
hub / github.com/grafana/dskit / TestReplicationSet_GetAddresses

Function TestReplicationSet_GetAddresses

ring/replication_set_test.go:23–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func 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
51func TestReplicationSet_GetAddressesWithout(t *testing.T) {
52 tests := map[string]struct {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.80
GetAddressesMethod · 0.80

Tested by

no test coverage detected