mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-03 20:40:26 -05:00
e2e: suppress or ignore init log output
klog calls during init are becoming a problem because now test/e2e/framework depends in test/utils/ktesting which bumps up the default verbosity during init to make test output more complete when there is no argument parsing. For cadvisor, an upstream fix is needed (https://github.com/google/cadvisor/pull/3778). For kubectl we can make it silently accept the valid (!) LC_ALL=C.
This commit is contained in:
parent
de47714879
commit
d17aaf5e29
2 changed files with 12 additions and 3 deletions
|
|
@ -24,6 +24,10 @@ cd "${KUBE_ROOT}"
|
|||
source hack/lib/init.sh
|
||||
ret=0
|
||||
|
||||
# We need deterministic sort order and want to avoid this extra log output:
|
||||
# i18n.go:119] Couldn't find the LC_ALL, LC_MESSAGES or LANG environment variables, defaulting to en_US
|
||||
export LC_ALL=C
|
||||
|
||||
# NOTE: Please do NOT add any to this list!!
|
||||
#
|
||||
# We are aiming to consolidate on: registry.k8s.io/e2e-test-images/agnhost
|
||||
|
|
@ -39,7 +43,10 @@ e2e_test="$(kube::util::find-binary e2e.test)"
|
|||
# validate "e2e.test --list-images":
|
||||
# - no unexpected output (whether it's on stderr or stdout)
|
||||
# - zero exit code (indirectly ensures that tests are set up properly)
|
||||
output=$("${e2e_test}" --list-images 2>&1) || ret=$?
|
||||
#
|
||||
# For now (https://github.com/google/cadvisor/issues/3707, https://github.com/google/cadvisor/pull/3778)
|
||||
# we have to ignore additional output caused by cadvisor.
|
||||
output=$("${e2e_test}" --list-images 2>&1 | grep -v 'factory.go.*Registered Plugin' ) || ret=$?
|
||||
if [[ $ret -ne 0 ]]; then
|
||||
>&2 echo "FAIL: '${e2e_test} --list-images' failed:"
|
||||
>&2 echo "${output}"
|
||||
|
|
@ -54,7 +61,7 @@ if [[ -n "${unexpected_output}" ]]; then
|
|||
fi
|
||||
|
||||
# extract image names without the version
|
||||
kube::util::read-array IMAGES < <(echo "${output}" | sed -E 's/^([[:alnum:]/.-]+):[^:]+$/\1/' | LC_ALL=C sort -u)
|
||||
kube::util::read-array IMAGES < <(echo "${output}" | sed -E 's/^([[:alnum:]/.-]+):[^:]+$/\1/' | sort -u)
|
||||
|
||||
# diff versus known permitted images
|
||||
>&2 echo "Diffing e2e image list ..."
|
||||
|
|
|
|||
|
|
@ -121,7 +121,9 @@ func loadSystemLanguage() string {
|
|||
}
|
||||
pieces := strings.Split(langStr, ".")
|
||||
if len(pieces) != 2 {
|
||||
klog.V(3).Infof("Unexpected system language (%s), defaulting to en_US", langStr)
|
||||
if langStr != "C" {
|
||||
klog.V(3).Infof("Unexpected system language (%s), defaulting to en_US", langStr)
|
||||
}
|
||||
return "default"
|
||||
}
|
||||
return pieces[0]
|
||||
|
|
|
|||
Loading…
Reference in a new issue