mirror of https://github.com/linkerd/linkerd2.git
Stop ignoring client-go log entries (#3315)
* Stop ignoring client-go log entries Pipe klog output into logrus. Not doing this avoids us from seeing client-go log entries, for some reason I don't understand. To enable, `--controller-log-level` must be `debug`. This was discovered while trying to debug sending events for #3253. I added an integration test that fails when this piping is not in place. Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
This commit is contained in:
parent
ea27e0ca0e
commit
9ee98d35be
|
@ -44,6 +44,8 @@ func setLogLevel(logLevel string) {
|
|||
flag.Set("stderrthreshold", "INFO")
|
||||
flag.Set("logtostderr", "true")
|
||||
flag.Set("v", "6") // At 7 and higher, authorization tokens get logged.
|
||||
// pipe klog entries to logrus
|
||||
klog.SetOutput(log.StandardLogger().Writer())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,7 @@ func TestInstallHelm(t *testing.T) {
|
|||
}
|
||||
|
||||
args := []string{
|
||||
"--set", "ControllerLogLevel=debug",
|
||||
"--set", "LinkerdVersion=" + TestHelper.GetVersion(),
|
||||
"--set", "Proxy.Image.Version=" + TestHelper.GetVersion(),
|
||||
"--set", "Identity.TrustDomain=cluster.local",
|
||||
|
@ -489,6 +490,8 @@ func TestCheckProxy(t *testing.T) {
|
|||
func TestLogs(t *testing.T) {
|
||||
controllerRegex := regexp.MustCompile("level=(panic|fatal|error|warn)")
|
||||
proxyRegex := regexp.MustCompile(fmt.Sprintf("%s (ERR|WARN)", k8s.ProxyContainerName))
|
||||
clientGoRegex := regexp.MustCompile("client-go@")
|
||||
hasClientGoLogs := false
|
||||
|
||||
for deploy, spec := range linkerdDeployReplicas {
|
||||
deploy := strings.TrimPrefix(deploy, "linkerd-")
|
||||
|
@ -537,10 +540,16 @@ func TestLogs(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if clientGoRegex.MatchString((line)) {
|
||||
hasClientGoLogs = true
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if !hasClientGoLogs {
|
||||
t.Errorf("Didn't find any client-go entries")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvents(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue