mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-20 09:05:26 +00:00
Merge pull request #36189 from euank/kubelet-nolog-redir
Automatic merge from submit-queue kubelet: don't print httplogs for redirects Goes with #36020, but can merge independently. cc @timstclair
This commit is contained in:
commit
3cdf8bb1ef
@ -24,6 +24,20 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDefaultStacktracePred(t *testing.T) {
|
||||
for _, x := range []int{101, 200, 204, 302, 400, 404} {
|
||||
if DefaultStacktracePred(x) {
|
||||
t.Fatalf("should not log on %v by default", x)
|
||||
}
|
||||
}
|
||||
|
||||
for _, x := range []int{500, 100} {
|
||||
if !DefaultStacktracePred(x) {
|
||||
t.Fatalf("should log on %v by default", x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandler(t *testing.T) {
|
||||
want := &httptest.ResponseRecorder{
|
||||
HeaderMap: make(http.Header),
|
||||
|
@ -726,6 +726,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
defer httplog.NewLogged(req, &w).StacktraceWhen(
|
||||
httplog.StatusIsNot(
|
||||
http.StatusOK,
|
||||
http.StatusFound,
|
||||
http.StatusMovedPermanently,
|
||||
http.StatusTemporaryRedirect,
|
||||
http.StatusBadRequest,
|
||||
|
Loading…
Reference in New Issue
Block a user