-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSS-4838 Audit Log improvements (#1042)
* Audit log fixes * Add omitempty on relevant audit log fields * Fix test * Moved NewConversationID to utils package - Created new utils package
- Loading branch information
Showing
8 changed files
with
51 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package utils | ||
|
||
import ( | ||
"crypto/rand" | ||
"encoding/hex" | ||
) | ||
|
||
// NewConversationID generates a unique ID that is used for the | ||
// lifetime of a websocket connection. | ||
func NewConversationID() string { | ||
buf := make([]byte, 8) | ||
rand.Read(buf) // Can't fail | ||
return hex.EncodeToString(buf) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package utils_test | ||
|
||
import ( | ||
"testing" | ||
|
||
qt "github.com/frankban/quicktest" | ||
|
||
"github.com/canonical/jimm/internal/utils" | ||
) | ||
|
||
func TestNewConversationID(t *testing.T) { | ||
c := qt.New(t) | ||
res := utils.NewConversationID() | ||
c.Assert(res, qt.HasLen, 16) | ||
} |