MCPcopy Create free account
hub / github.com/zalando/skipper / TestPredicateList

Function TestPredicateList

routing/predicates_test.go:15–1201  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestPredicateList(t *testing.T) {
16 type check struct {
17 request *http.Request
18 expectedID string
19 allowedIDs []string
20 expectedParams map[string]string
21 }
22
23 for _, test := range []struct {
24 title string
25 options MatchingOptions
26 routes []*eskip.Route
27 checks []check
28 }{{
29
30 title: "only legacy predicate",
31 routes: []*eskip.Route{{
32 Id: "test",
33 Headers: map[string]string{
34 "X-Test": "foo",
35 },
36 BackendType: eskip.ShuntBackend,
37 }, {
38 Id: "catchAll",
39 BackendType: eskip.ShuntBackend,
40 }},
41 checks: []check{{
42 request: &http.Request{
43 URL: &url.URL{Path: "/"},
44 Header: http.Header{
45 "X-Test": []string{"foo"},
46 },
47 },
48 expectedID: "test",
49 }, {
50 request: &http.Request{
51 URL: &url.URL{Path: "/"},
52 },
53 expectedID: "catchAll",
54 }},
55 }, {
56
57 title: "only legacy predicate, path",
58 routes: []*eskip.Route{{
59 Id: "test",
60 Path: "/foo",
61 BackendType: eskip.ShuntBackend,
62 }, {
63 Id: "catchAll",
64 BackendType: eskip.ShuntBackend,
65 }},
66 checks: []check{{
67 request: &http.Request{
68 URL: &url.URL{Path: "/foo"},
69 },
70 expectedID: "test",
71 }, {
72 request: &http.Request{

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
NewFunction · 0.92
UnmuteMethod · 0.80
RouteMethod · 0.80
NewFunction · 0.70
CloseMethod · 0.65
ErrorMethod · 0.65
ErrorfMethod · 0.65
WaitForMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…