36b3af2e3d
PR Check / Code Quality: Format (push) Failing after 1s
PR Check / Code Quality: Lint (darwin) (push) Failing after 0s
PR Check / Code Quality: Lint (freebsd) (push) Failing after 1s
PR Check / Code Quality: Lint (windows) (push) Failing after 1s
PR Check / Code Quality: Lint (linux) (push) Failing after 1s
PR Check / Security: Vulnerability Scan (push) Failing after 0s
Update Documentation / update-docs (push) Failing after 2s
PR Check / Code Quality: Vendor (push) Failing after 1s
PR Check / Code Quality: Coverage (push) Failing after 0s
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
32 lines
664 B
Go
32 lines
664 B
Go
//go:build windows
|
|
|
|
package proc
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestBootTimeIsInThePast(t *testing.T) {
|
|
if bt := bootTime(); !bt.Before(time.Now()) {
|
|
t.Errorf("bootTime() = %v, expected a time in the past", bt)
|
|
}
|
|
}
|
|
|
|
func TestBootTimeIsAfter2000(t *testing.T) {
|
|
floor := time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)
|
|
if bt := bootTime(); bt.Before(floor) {
|
|
t.Errorf("bootTime() = %v, expected >= %v", bt, floor)
|
|
}
|
|
}
|
|
|
|
func TestBootTimeUptimeReasonable(t *testing.T) {
|
|
uptime := time.Since(bootTime())
|
|
if uptime < 0 {
|
|
t.Errorf("uptime is negative: %v", uptime)
|
|
}
|
|
if uptime > 100*365*24*time.Hour {
|
|
t.Errorf("uptime > 100 years: %v", uptime)
|
|
}
|
|
}
|