MCPcopy
hub / github.com/etcd-io/etcd / ExampleCluster_memberList

Function ExampleCluster_memberList

client/v3/example_cluster_test.go:29–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func ExampleCluster_memberList() {
30 forUnitTestsRunInMockedContext(mockCluster_memberList, func() {
31 cli, err := clientv3.New(clientv3.Config{
32 Endpoints: exampleEndpoints(),
33 DialTimeout: dialTimeout,
34 })
35 if err != nil {
36 log.Fatal(err)
37 }
38 defer cli.Close()
39
40 resp, err := cli.MemberList(context.Background())
41 if err != nil {
42 log.Fatal(err)
43 }
44 fmt.Println("members:", len(resp.Members))
45 })
46 // Output: members: 3
47}
48
49func mockCluster_memberAdd() {
50 fmt.Println("added member.PeerURLs: [http://localhost:32380]")

Callers

nothing calls this directly

Calls 5

exampleEndpointsFunction · 0.70
FatalMethod · 0.65
CloseMethod · 0.65
MemberListMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…