-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record compliance events in the compliance history API with nanoseconds
This helps with ordering when compliance events have a timestamp that is the same down to the second. Relates: https://issues.redhat.com/browse/ACM-10155 Signed-off-by: mprahl <mprahl@users.noreply.github.com>
- Loading branch information
1 parent
a332e0a
commit a3c206c
Showing
3 changed files
with
60 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright Contributors to the Open Cluster Management project | ||
package statussync | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestParseTimestampFromEventName(t *testing.T) { | ||
output, err := parseTimestampFromEventName("event.17b80d88a995e12c") | ||
if err != nil { | ||
t.Errorf("Expected no error but got: %v", err) | ||
} else if output.Time.UnixNano() != 1709130939198988588 { | ||
t.Errorf("Expected 1709130939198988588 but got: %d", output.Time.UnixNano()) | ||
} | ||
|
||
output, err = parseTimestampFromEventName("event.with-no-timestamp") | ||
if err == nil { | ||
t.Errorf("Expected an error but got none: %s", output) | ||
} | ||
} |
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