tests: Add secureboot enabled test

Signed-off-by: Morten Linderud <morten@linderud.pw>
This commit is contained in:
Morten Linderud 2021-06-01 01:03:24 +02:00
parent 95170e5117
commit 683afec1d7
No known key found for this signature in database
GPG Key ID: E742683BA08CB2FF
2 changed files with 27 additions and 0 deletions

View File

@ -14,10 +14,16 @@ import (
func TestKeyEnrollment(t *testing.T) {
conf := utils.NewConfig()
conf.AddFile("sbctl")
utils.WithVM(conf,
func(vm *utils.TestVM) {
t.Run("Enroll Keys", vm.RunTest("./integrations/enroll_keys_test.go"))
})
utils.WithVM(conf,
func(vm *utils.TestVM) {
t.Run("Check SecureBoot enabled", vm.RunTest("./integrations/secure_boot_enabled_test.go"))
})
}
func TestMain(m *testing.M) {

View File

@ -0,0 +1,21 @@
package main
import (
"testing"
"github.com/foxboron/go-uefi/efi"
"github.com/foxboron/sbctl/tests/utils"
)
func TestSecureBootEnabled(t *testing.T) {
utils.Exec("/mnt/sbctl status")
if !efi.GetSecureBoot() {
t.Fatal("not in secure boot mode")
}
if efi.GetSetupMode() {
t.Fatal("in setup mode")
}
}