e2e framework: fix inconsistency in log output

Example:

    I1208 16:01:05.852628 243 upgradedowngrade_test.go:239] get source code version: bring up v1.34: cluster is running, use KUBECONFIG=/var/run/kubernetes/admin.kubeconfig to access it
    I1208 16:01:05.869679     243 reflector.go:446] "Caches populated" type="*v1.ServiceAccount" reflector="k8s.io/client-go/tools/watch/informerwatcher.go:162"

The first line is printed via framework.Logf, which is meant to emulate the
format used by the klog text logger in the second line. The difference is that
klog formats the pid with 7 characters, padding on the left with spaces.

Consistency trumps brevity here, so let's format exactly as in klog.
This commit is contained in:
Patrick Ohly 2025-12-08 17:57:23 +01:00
parent e0514f6656
commit 1a866b8795

View file

@ -110,7 +110,7 @@ func log(offset int, msg string) {
}
_, month, day := now.Date()
hour, minute, second := now.Clock()
header := fmt.Sprintf("I%02d%02d %02d:%02d:%02d.%06d %d %s:%d]",
header := fmt.Sprintf("I%02d%02d %02d:%02d:%02d.%06d %7d %s:%d]",
month, day, hour, minute, second, now.Nanosecond()/1000, Pid, file, line)
fmt.Fprintln(ginkgo.GinkgoWriter, header, msg)