MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / testGetCluster

Function testGetCluster

scope_test.go:461–489  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

459}
460
461func testGetCluster() *cluster {
462 c := &cluster{
463 name: "default",
464 replicas: []*replica{{}, {}, {}},
465 }
466
467 r1 := c.replicas[0]
468 r1.cluster = c
469 r1.hosts = []*topology.Node{
470 topology.NewNode(&url.URL{Host: "127.0.0.11"}, nil, "", r1.name, topology.WithDefaultActiveState(true)),
471 topology.NewNode(&url.URL{Host: "127.0.0.22"}, nil, "", r1.name, topology.WithDefaultActiveState(true)),
472 }
473 r1.name = "replica1"
474 r2 := c.replicas[1]
475 r2.cluster = c
476 r2.hosts = []*topology.Node{
477 topology.NewNode(&url.URL{Host: "127.0.0.33"}, nil, "", r2.name, topology.WithDefaultActiveState(true)),
478 topology.NewNode(&url.URL{Host: "127.0.0.44"}, nil, "", r2.name, topology.WithDefaultActiveState(true)),
479 }
480 r2.name = "replica2"
481 r3 := c.replicas[2]
482 r3.cluster = c
483 r3.hosts = []*topology.Node{
484 topology.NewNode(&url.URL{Host: "127.0.0.55"}, nil, "", r3.name, topology.WithDefaultActiveState(true)),
485 topology.NewNode(&url.URL{Host: "127.0.0.66"}, nil, "", r3.name, topology.WithDefaultActiveState(true)),
486 }
487 r3.name = "replica3"
488 return c
489}
490
491func testGetClusterUser() *clusterUser {
492 cu = &clusterUser{

Callers 2

TestGetHostStickyFunction · 0.85
TestIncQueuedFunction · 0.85

Calls 2

NewNodeFunction · 0.92
WithDefaultActiveStateFunction · 0.92

Tested by

no test coverage detected