Skip to content

Commit 09beb0e

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

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

config/configtls/tpm_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,29 @@ VGhpcyBpcyBub3QgYSBjZXJ0aWZpY2F0ZS4=
135135
}
136136
}
137137

138+
func TestTPM_open(t *testing.T) {
139+
tests := []struct {
140+
path string
141+
err string
142+
}{
143+
{
144+
path: "",
145+
err: "TPM path is not set",
146+
},
147+
{
148+
path: "/foo",
149+
err: "failed to open TPM (/foo): stat /foo: no such file or directory",
150+
},
151+
}
152+
for _, test := range tests {
153+
t.Run(test.path, func(t *testing.T) {
154+
tpm, err := openTPM(test.path)()
155+
require.Nil(t, tpm)
156+
assert.Equal(t, test.err, err.Error())
157+
})
158+
}
159+
}
160+
138161
func createTPMKeyCert(t *testing.T, tpm transport.TPMCloser) ([]byte, []byte) {
139162
tpmKey, err := keyfile.NewLoadableKey(tpm, tpm2.TPMAlgECC, 256, []byte(""))
140163
require.NoError(t, err)

0 commit comments

Comments
 (0)