(predicates []routing.PredicateSpec, fr filters.Registry, doc string, params Params, preprocs []routing.PreProcessor)
| 209 | } |
| 210 | |
| 211 | func newCustomTestProxy(predicates []routing.PredicateSpec, fr filters.Registry, doc string, params Params, preprocs []routing.PreProcessor) (*testProxy, error) { |
| 212 | dc, err := testdataclient.NewDoc(doc) |
| 213 | if err != nil { |
| 214 | return nil, err |
| 215 | } |
| 216 | |
| 217 | if fr == nil { |
| 218 | fr = builtin.MakeRegistry() |
| 219 | } |
| 220 | |
| 221 | tl := loggingtest.New() |
| 222 | if params.EndpointRegistry == nil { |
| 223 | params.EndpointRegistry = routing.NewEndpointRegistry(routing.RegistryOptions{}) |
| 224 | } |
| 225 | opts := routing.Options{ |
| 226 | FilterRegistry: fr, |
| 227 | PollTimeout: sourcePollTimeout, |
| 228 | DataClients: []routing.DataClient{dc}, |
| 229 | PostProcessors: []routing.PostProcessor{loadbalancer.NewAlgorithmProvider(), params.EndpointRegistry}, |
| 230 | Log: tl, |
| 231 | Predicates: append([]routing.PredicateSpec{teePredicate.New()}, predicates...), |
| 232 | } |
| 233 | if len(preprocs) > 0 { |
| 234 | opts.PreProcessors = preprocs |
| 235 | } |
| 236 | rt := routing.New(opts) |
| 237 | |
| 238 | params.Routing = rt |
| 239 | p := WithParams(params) |
| 240 | p.log = tl |
| 241 | |
| 242 | if err := tl.WaitFor("route settings applied", time.Second); err != nil { |
| 243 | return nil, err |
| 244 | } |
| 245 | |
| 246 | return &testProxy{tl, dc, rt, p}, nil |
| 247 | } |
| 248 | |
| 249 | func newTestProxyWithFiltersAndParams(fr filters.Registry, doc string, params Params, preprocs []routing.PreProcessor) (*testProxy, error) { |
| 250 | return newCustomTestProxy(nil, fr, doc, params, preprocs) |
no test coverage detected
searching dependent graphs…