Skip to content

Commit

Permalink
add better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl committed Jun 13, 2024
1 parent ec12eb5 commit e57930c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/util/steps/condition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion pkg/util/steps/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
}
Expand Down

0 comments on commit e57930c

Please sign in to comment.