mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-10-29 18:49:20 +08:00
- Introduced `started_at` and `uptime_seconds` fields to the `SystemInfo` structure for tracking server boot time and uptime. - Updated the `GetSystemInfo` handler to populate these new fields based on server runtime. - Enhanced the frontend to display server startup time and uptime in the system information view, improving visibility for users. - Added localization support for new labels and descriptions related to server uptime and startup time in multiple languages.
19 lines
364 B
Go
19 lines
364 B
Go
package runtime
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestMarkServerStartedAndUptime(t *testing.T) {
|
|
MarkServerStarted()
|
|
boot := ServerStartedAt()
|
|
if boot.IsZero() {
|
|
t.Fatal("ServerStartedAt should be set after MarkServerStarted")
|
|
}
|
|
time.Sleep(2 * time.Millisecond)
|
|
if got := ServerUptime(); got <= 0 {
|
|
t.Fatalf("ServerUptime() = %v, want > 0", got)
|
|
}
|
|
}
|