mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Merge pull request #120750 from pohly/test-output-init-fix
e2e framework: adapt unit test to Go 1.22
This commit is contained in:
commit
d924775d78
@ -110,6 +110,7 @@ func simplify(in string, expected TestResult) string {
|
|||||||
out := normalizeLocation(in)
|
out := normalizeLocation(in)
|
||||||
out = stripTimes(out)
|
out = stripTimes(out)
|
||||||
out = stripAddresses(out)
|
out = stripAddresses(out)
|
||||||
|
out = normalizeInitFunctions(out)
|
||||||
if expected.NormalizeOutput != nil {
|
if expected.NormalizeOutput != nil {
|
||||||
out = expected.NormalizeOutput(out)
|
out = expected.NormalizeOutput(out)
|
||||||
}
|
}
|
||||||
@ -178,3 +179,12 @@ func normalizeLocation(in string) string {
|
|||||||
out = klogPrefix.ReplaceAllString(out, "<klog> ")
|
out = klogPrefix.ReplaceAllString(out, "<klog> ")
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var initFunc = regexp.MustCompile(`(init\.+func|glob\.+func)`)
|
||||||
|
|
||||||
|
// normalizeInitFunctions maps both init.func (used by Go >= 1.22) and
|
||||||
|
// glob..func (used by Go < 1.22) to <init.func>.
|
||||||
|
func normalizeInitFunctions(in string) string {
|
||||||
|
out := initFunc.ReplaceAllString(in, "<init.func>")
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user