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

Function testPatch

proxy/pathpatch_test.go:13–46  ·  view source on GitHub ↗
(t *testing.T, title string, f Flags, expectedStatus int)

Source from the content-addressed store, hash-verified

11)
12
13func testPatch(t *testing.T, title string, f Flags, expectedStatus int) {
14 t.Run(title, func(t *testing.T) {
15 dc, err := routestring.New(`Path("/foo%2Fbar") -> status(200) -> <shunt>`)
16 if err != nil {
17 t.Fatal(err)
18 }
19
20 rt := routing.New(routing.Options{
21 SignalFirstLoad: true,
22 FilterRegistry: builtin.MakeRegistry(),
23 DataClients: []routing.DataClient{dc},
24 })
25 defer rt.Close()
26
27 p := WithParams(Params{Routing: rt, Flags: f})
28 defer p.Close()
29
30 s := httptest.NewServer(p)
31 defer s.Close()
32
33 <-rt.FirstLoad()
34
35 rsp, err := http.Get(s.URL + "/foo%2Fbar")
36 if err != nil {
37 t.Fatal(err)
38 }
39
40 defer rsp.Body.Close()
41
42 if rsp.StatusCode != expectedStatus {
43 t.Error()
44 }
45 })
46}
47
48func TestPathPatch(t *testing.T) {
49 testPatch(t, "not patched", FlagsNone, http.StatusNotFound)

Callers 1

TestPathPatchFunction · 0.85

Calls 8

NewFunction · 0.92
NewFunction · 0.92
MakeRegistryFunction · 0.92
FirstLoadMethod · 0.80
WithParamsFunction · 0.70
CloseMethod · 0.65
GetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…