MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / TestLogMask

Function TestLogMask

log/log_test.go:12–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestLogMask(t *testing.T) {
13 err := InitReplacer([]config.LogMask{
14 {
15 Regex: `(s3\(\s*'(?:(?:\\'|[^'])*)'\s*,\s*'(?:(?:\\'|[^'])*)'\s*,\s*')((?:\\'|[^'])*)(')`,
16 Replacement: "$1******$3",
17 },
18 })
19 assert.NoError(t, err)
20 var b bytes.Buffer
21 testLogger := log.New(&b, "DEBUG: ", stdLogFlags)
22 err = testLogger.Output(outputCallDepth,
23 mask("select * from s3('http://s3server/bucket', 'access-key', 'seret-key', 'CSVWithNamesAndTypes')"))
24 assert.NoError(t, err)
25 res, err := b.ReadString('\n')
26 assert.NoError(t, err)
27 assert.Contains(t, res, "select * from s3('http://s3server/bucket', 'access-key', '******', 'CSVWithNamesAndTypes')")
28}

Callers

nothing calls this directly

Calls 3

InitReplacerFunction · 0.85
maskFunction · 0.85
ContainsMethod · 0.80

Tested by

no test coverage detected