(hs []string)
| 200 | } |
| 201 | |
| 202 | func 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 | |
| 234 | func newMockScope(hs []string) *scope { |
| 235 | c := newHostsCluster(hs) |
no test coverage detected