Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster: reverse the order of audit log list #1538

Merged
merged 3 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cluster/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func GetAuditList(dir string) ([]Item, error) {
}

sort.Slice(auditList, func(i, j int) bool {
return auditList[i].Time > auditList[j].Time
return auditList[i].Time < auditList[j].Time
})

return auditList, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/cluster/audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ func (s *testAuditSuite) TestShowAuditLog(c *C) {
// tabby table size is based on column width, while time.RFC3339 maybe print out timezone like +08:00 or Z(UTC)
// skip the first two lines
list := strings.Join(strings.Split(readFakeStdout(f), "\n")[2:], "\n")
c.Assert(list, Equals, fmt.Sprintf(`ftmpqzww84Q %s test with nanosecond
4F7ZTL %s test with second
c.Assert(list, Equals, fmt.Sprintf(`4F7ZTL %s test with second
ftmpqzww84Q %s test with nanosecond
`,
time.Unix(nanoSecond/1e9, 0).Format(time.RFC3339),
time.Unix(second, 0).Format(time.RFC3339),
time.Unix(nanoSecond/1e9, 0).Format(time.RFC3339),
))
f.Close()

Expand Down