Skip to content

Commit 70746d5

Browse files
committed
Fix
Signed-off-by: Pavol Loffay <[email protected]>
1 parent 09beb0e commit 70746d5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

config/configtls/tpm_test.go

+16-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"github.com/stretchr/testify/require"
3030
)
3131

32-
func TestTPMGeneratedKey(t *testing.T) {
32+
func TestTPM_loadCertificate(t *testing.T) {
3333
tpm, err := simulator.OpenSimulator()
3434
require.NoError(t, err)
3535
defer tpm.Close()
@@ -82,7 +82,21 @@ func TestTPMGeneratedKey(t *testing.T) {
8282
assert.True(t, ok)
8383
}
8484

85-
func TestTPM_errors(t *testing.T) {
85+
func TestTPM_loadCertificate_error(t *testing.T) {
86+
tlsCfg := Config{
87+
CertPem: "invalid",
88+
KeyPem: "invalid",
89+
TPMConfig: TPMConfig{
90+
Enabled: true,
91+
Path: "simulator",
92+
},
93+
}
94+
tlsCertificate, err := tlsCfg.loadCertificate()
95+
assert.Equal(t, "failed to load private key from TPM: failed to load TPM key: not an armored key", err.Error())
96+
require.NotNil(t, tlsCertificate)
97+
}
98+
99+
func TestTPM_tpmCertificate_errors(t *testing.T) {
86100
tpm, err := simulator.OpenSimulator()
87101
require.NoError(t, err)
88102
defer tpm.Close()

0 commit comments

Comments
 (0)