mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
e2e framework: adapt unit test to Go 1.22
Go 1.22 changed the name of init functions from "glob..func" to "init.func". That difference is acceptable and has to be ignored when comparing output.
This commit is contained in:
parent
f7dacb63cc
commit
83c37acb21
@ -110,6 +110,7 @@ func simplify(in string, expected TestResult) string {
|
||||
out := normalizeLocation(in)
|
||||
out = stripTimes(out)
|
||||
out = stripAddresses(out)
|
||||
out = normalizeInitFunctions(out)
|
||||
if expected.NormalizeOutput != nil {
|
||||
out = expected.NormalizeOutput(out)
|
||||
}
|
||||
@ -178,3 +179,12 @@ func normalizeLocation(in string) string {
|
||||
out = klogPrefix.ReplaceAllString(out, "<klog> ")
|
||||
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