MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestReplicationSet_GetAddresses

Function TestReplicationSet_GetAddresses

pkg/ring/replication_set_test.go:18–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func 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
46func TestReplicationSet_GetAddressesWithout(t *testing.T) {
47 tests := map[string]struct {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65
GetAddressesMethod · 0.45

Tested by

no test coverage detected