MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestHTTPLoggingRedaction

Function TestHTTPLoggingRedaction

rest/logging_test.go:19–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestHTTPLoggingRedaction(t *testing.T) {
20
21 base.SetUpTestLogging(t, base.LevelInfo, base.KeyHTTP)
22 base.LongRunningTest(t)
23 rt := NewRestTester(t, nil)
24 defer rt.Close()
25
26 keyspace := rt.GetSingleKeyspace()
27
28 cases := []struct {
29 name, method, path, expectedLog string
30 admin bool
31 }{
32 {
33 name: "docid",
34 method: http.MethodGet,
35 path: "/db/test",
36 expectedLog: "/db/<ud>test</ud>",
37 },
38 {
39 name: "local",
40 method: http.MethodGet,
41 path: "/db/_local/test",
42 expectedLog: "/db/_local/<ud>test</ud>",
43 },
44 {
45 name: "raw-docid",
46 method: http.MethodGet,
47 path: fmt.Sprintf("/%s/_raw/test", keyspace),
48 expectedLog: fmt.Sprintf("/%s/_raw/<ud>test</ud>", keyspace),
49 admin: true,
50 },
51 {
52 name: "revtree-docid",
53 method: http.MethodGet,
54 path: fmt.Sprintf("/%s/_revtree/test", keyspace),
55 expectedLog: fmt.Sprintf("/%s/_revtree/<ud>test</ud>", keyspace),
56 admin: true,
57 },
58 {
59 name: "docid-attach",
60 method: http.MethodGet,
61 path: fmt.Sprintf("/%s/test/attach", keyspace),
62 expectedLog: fmt.Sprintf("/%s/<ud>test</ud>/<ud>attach</ud>", keyspace),
63 },
64 {
65 name: "docid-attach-equalnames",
66 method: http.MethodGet,
67 path: fmt.Sprintf("/%s/test/test", keyspace),
68 expectedLog: fmt.Sprintf("/%s/<ud>test</ud>/<ud>test</ud>", keyspace),
69 },
70 {
71 name: "user",
72 method: http.MethodGet,
73 path: "/db/_user/foo",
74 expectedLog: "/db/_user/<ud>foo</ud>",
75 admin: true,
76 },

Callers

nothing calls this directly

Calls 9

CloseMethod · 0.95
GetSingleKeyspaceMethod · 0.95
SendAdminRequestMethod · 0.95
SendRequestMethod · 0.95
SetUpTestLoggingFunction · 0.92
LongRunningTestFunction · 0.92
AssertLogContainsFunction · 0.92
NewRestTesterFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected