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

Function TestDisableAccessLog

proxy/proxy_test.go:1958–1988  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1956}
1957
1958func TestDisableAccessLog(t *testing.T) {
1959 var buf bytes.Buffer
1960 al := logging.NewAccessLogger(logging.Options{
1961 AccessLogOutput: &buf})
1962
1963 response := "7 bytes"
1964
1965 u, _ := url.ParseRequestURI("https://www.example.org/hello")
1966 r := &http.Request{
1967 URL: u,
1968 Method: "GET",
1969 Header: http.Header{"Connection": []string{"token"}}}
1970 w := httptest.NewRecorder()
1971
1972 doc := fmt.Sprintf(`hello: Path("/hello") -> status(%d) -> inlineContent("%s") -> <shunt>`, http.StatusTeapot, response)
1973
1974 tp, err := newTestProxyWithParams(doc, Params{
1975 AccessLogDisabled: true,
1976 AccessLogger: al,
1977 })
1978 if err != nil {
1979 t.Fatal(err)
1980 }
1981 defer tp.close()
1982
1983 tp.proxy.ServeHTTP(w, r)
1984
1985 if buf.Len() != 0 {
1986 t.Error("failed to disable access log")
1987 }
1988}
1989
1990func TestDisableAccessLogWithFilter(t *testing.T) {
1991 for _, ti := range []struct {

Callers

nothing calls this directly

Calls 6

NewAccessLoggerFunction · 0.92
newTestProxyWithParamsFunction · 0.85
LenMethod · 0.65
ErrorMethod · 0.65
closeMethod · 0.45
ServeHTTPMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…