attestation: allow "go test" to work with CGO disabled

This commit is contained in:
Malte Poll 2023-08-18 16:16:46 +02:00 committed by Malte Poll
parent 1d5f244879
commit 75ed8c9f3e
7 changed files with 55 additions and 0 deletions

View file

@ -16,6 +16,7 @@ import (
"encoding/json"
"errors"
"fmt"
"os"
"testing"
"github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest"
@ -31,6 +32,10 @@ import (
)
func TestTrustedKeyFromSNP(t *testing.T) {
cgo := os.Getenv("CGO_ENABLED")
if cgo == "0" {
t.Skip("skipping test because CGO is disabled and tpm simulator requires it")
}
require := require.New(t)
tpm, err := simulator.OpenSimulatedTPM()
@ -237,6 +242,10 @@ func TestTrustedKeyFromSNP(t *testing.T) {
}
func TestValidateAk(t *testing.T) {
cgo := os.Getenv("CGO_ENABLED")
if cgo == "0" {
t.Skip("skipping test because CGO is disabled and tpm simulator requires it")
}
require := require.New(t)
tpm, err := simulator.OpenSimulatedTPM()