Remove superfluous test case

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2024-04-12 15:35:46 +02:00
parent a4bbaae233
commit 0bbec8f307
No known key found for this signature in database
GPG Key ID: 7DD3015F3DDE4B9C
2 changed files with 0 additions and 86 deletions

View File

@ -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",
],
)

View File

@ -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
}