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

Function newHostsCluster

proxyretry_test.go:202–232  ·  view source on GitHub ↗
(hs []string)

Source from the content-addressed store, hash-verified

200}
201
202func newHostsCluster(hs []string) *cluster {
203 // set up cluster, replicas, hosts
204 cluster1 := &cluster{
205 name: "cluster1",
206 }
207
208 var hosts []*topology.Node
209
210 replica1 := &replica{
211 cluster: cluster1,
212 name: "replica1",
213 nextHostIdx: 0,
214 }
215
216 cluster1.replicas = []*replica{replica1}
217
218 for i := 0; i < len(hs); i++ {
219 url1 := &url.URL{
220 Scheme: "http",
221 Host: hs[i],
222 }
223 hosti := topology.NewNode(url1, nil, "", replica1.name)
224 hosti.SetIsActive(true)
225
226 hosts = append(hosts, hosti)
227 }
228
229 replica1.hosts = hosts
230
231 return cluster1
232}
233
234func newMockScope(hs []string) *scope {
235 c := newHostsCluster(hs)

Callers 1

newMockScopeFunction · 0.85

Calls 2

SetIsActiveMethod · 0.95
NewNodeFunction · 0.92

Tested by

no test coverage detected