Skip to content

Commit

Permalink
Improve comment on IDSeparator
Browse files Browse the repository at this point in the history
  • Loading branch information
denisonbarbosa committed Sep 5, 2023
1 parent 8c7b28d commit bb65835
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/testutils/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
objectPathFmt = "/com/ubuntu/authd/%s"
interfaceFmt = "com.ubuntu.authd.%s"

// IDSeparator is the value used to trim the sessionID in the broker mock.
// IDSeparator is the value used to append values to the sessionID in the broker mock.
IDSeparator = "_separator_"
)

Expand Down Expand Up @@ -281,8 +281,10 @@ func (b *BrokerBusMock) CancelIsAuthorized(sessionID string) (dbusErr *dbus.Erro
}

// parseSessionID is wrapper around the sessionID to remove some values appended during the tests.
//
// The sessionID can have multiple values appended to differentiate between subtests and avoid concurrency conflicts,
// and only the last value (i.e. "..._separator_ID-session_id") will be considered.
func parseSessionID(sessionID string) string {
// We need to prefix the sessionID with the test name in some tests, so we have to consider this here in the broker.
cut := strings.Split(sessionID, IDSeparator)
if len(cut) == 0 {
return ""
Expand Down

0 comments on commit bb65835

Please sign in to comment.