MCPcopy Index your code
hub / github.com/zalando/skipper / newCustomTestProxy

Function newCustomTestProxy

proxy/proxy_test.go:211–247  ·  view source on GitHub ↗
(predicates []routing.PredicateSpec, fr filters.Registry, doc string, params Params, preprocs []routing.PreProcessor)

Source from the content-addressed store, hash-verified

209}
210
211func 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
249func newTestProxyWithFiltersAndParams(fr filters.Registry, doc string, params Params, preprocs []routing.PreProcessor) (*testProxy, error) {
250 return newCustomTestProxy(nil, fr, doc, params, preprocs)

Calls 9

NewDocFunction · 0.92
MakeRegistryFunction · 0.92
NewFunction · 0.92
NewEndpointRegistryFunction · 0.92
NewAlgorithmProviderFunction · 0.92
NewFunction · 0.92
NewMethod · 0.80
WithParamsFunction · 0.70
WaitForMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…