Some checks failed
Test / ShareFS (push) Failing after 49s
Test / Create distribution (push) Failing after 51s
Test / Hakurei (race detector) (push) Failing after 59s
Test / Sandbox (push) Failing after 1m0s
Test / Hakurei (push) Failing after 1m11s
Test / Sandbox (race detector) (push) Failing after 1m7s
Test / Flake checks (push) Has been skipped
This currently relies on a trusted bootloader to determine the boot device. Signed-off-by: Ophestra <cat@gensokyo.uk>
36 lines
581 B
Go
36 lines
581 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
"testing/synctest"
|
|
"time"
|
|
)
|
|
|
|
func TestRejectColdboot(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
synctest.Test(t, func(t *testing.T) {
|
|
nextColdboot := newRejectColdboot()
|
|
want := func(want bool) {
|
|
if got := nextColdboot(); got != want {
|
|
t.Fatalf("nextColdboot: %v, want %v", got, want)
|
|
}
|
|
}
|
|
|
|
synctest.Wait()
|
|
want(true)
|
|
time.Sleep(time.Hour)
|
|
synctest.Wait()
|
|
want(true)
|
|
want(true)
|
|
time.Sleep(5 * time.Minute)
|
|
synctest.Wait()
|
|
want(true)
|
|
want(false)
|
|
time.Sleep(time.Hour)
|
|
synctest.Wait()
|
|
want(false)
|
|
want(false)
|
|
})
|
|
}
|