mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-04-21 15:56:26 -04:00
Remove superfluous test case
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
a4bbaae233
commit
0bbec8f307
@ -1,5 +1,4 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
load("//bazel/go:go_test.bzl", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "snp",
|
||||
@ -28,21 +27,3 @@ go_library(
|
||||
"@com_github_google_go_tpm_tools//proto/attest",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "snp_test",
|
||||
srcs = ["validator_test.go"],
|
||||
embed = [":snp"],
|
||||
# keep
|
||||
gotags = select({
|
||||
"//bazel/settings:tpm_simulator_enabled": [],
|
||||
"//conditions:default": ["disable_tpm_simulator"],
|
||||
}),
|
||||
deps = [
|
||||
"//internal/attestation",
|
||||
"//internal/attestation/vtpm",
|
||||
"//internal/config",
|
||||
"@com_github_google_go_tpm_tools//proto/attest",
|
||||
"@com_github_stretchr_testify//assert",
|
||||
],
|
||||
)
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package snp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto"
|
||||
"crypto/x509"
|
||||
"testing"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/attestation"
|
||||
"github.com/edgelesssys/constellation/v2/internal/attestation/vtpm"
|
||||
"github.com/edgelesssys/constellation/v2/internal/config"
|
||||
"github.com/google/go-tpm-tools/proto/attest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetTrustedKey(t *testing.T) {
|
||||
validator := func(ek []byte) *Validator {
|
||||
return &Validator{
|
||||
reportValidator: stubGCPValidator{},
|
||||
gceKeyGetter: func(_ context.Context, _ vtpm.AttestationDocument, _ []byte) (crypto.PublicKey, error) {
|
||||
return ek, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
testCases := map[string]struct {
|
||||
akPub []byte
|
||||
ek []byte
|
||||
info []byte
|
||||
}{
|
||||
"success": {
|
||||
akPub: []byte("akPub"),
|
||||
ek: []byte("ek"),
|
||||
info: []byte("info"),
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
out, err := validator(tc.ek).getTrustedKey(
|
||||
context.Background(),
|
||||
vtpm.AttestationDocument{
|
||||
Attestation: &attest.Attestation{
|
||||
AkPub: tc.akPub,
|
||||
},
|
||||
InstanceInfo: tc.info,
|
||||
},
|
||||
nil,
|
||||
)
|
||||
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.ek, out)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type stubGCPValidator struct{}
|
||||
|
||||
func (stubGCPValidator) validate(_ vtpm.AttestationDocument, _ *x509.Certificate, _ *x509.Certificate, _ [64]byte, _ *config.GCPSEVSNP, _ attestation.Logger) error {
|
||||
return nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user