diff --git a/pkg/util/steps/condition_test.go b/pkg/util/steps/condition_test.go index f0209cc322e..1476beb1e1e 100644 --- a/pkg/util/steps/condition_test.go +++ b/pkg/util/steps/condition_test.go @@ -30,6 +30,9 @@ func (n *teststruct) hiveClusterInstallationComplete(context.Context) (bool, err } func TestEnrichConditionTimeoutError(t *testing.T) { + // When stringifying a method on a struct, golang adds -fm -- this is not + // useful to us, so using a struct instance here will verify that it is not + // present when matching the timeout error strings s := &teststruct{} for _, tt := range []struct { diff --git a/pkg/util/steps/runner.go b/pkg/util/steps/runner.go index 06894226c51..30f4ee315ba 100644 --- a/pkg/util/steps/runner.go +++ b/pkg/util/steps/runner.go @@ -19,7 +19,10 @@ import ( msgraph_errors "github.com/Azure/ARO-RP/pkg/util/graph/graphsdk/models/odataerrors" ) -// FriendlyName returns a "friendly" stringified name of the given func. +// FriendlyName returns a "friendly" stringified name of the given func. This +// consists of removing the ARO base package name (so it produces pkg/foobar +// instead of github.com/Azure/ARO-RP/pkg/foobar) and removing the -fm suffix +// from Golang struct methods. func FriendlyName(f interface{}) string { return strings.TrimPrefix(strings.TrimSuffix(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), "-fm"), "github.com/Azure/ARO-RP/") }