Skip to content

Commit

Permalink
Replace prefix generation using tempdir with uuid
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Dec 9, 2024
1 parent d3e41c9 commit b7fa903
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cli/internal/pkcs11/pkcs11_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/ThalesGroup/crypto11"
"github.com/edgelesssys/marblerun/util"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -39,7 +40,7 @@ func TestLoadX509KeyPair(t *testing.T) {
init: func(t *testing.T) (keyID, keyLabel, certID, certLabel string) {
t.Helper()
require := require.New(t)
prefix := t.TempDir()
prefix := uuid.New().String()
keyID, keyLabel, certID, certLabel = prefix+"keyID", prefix+"keyLabel", prefix+"certID", prefix+"certLabel"
pkcs11, err := crypto11.ConfigureFromFile(*configPath)
require.NoError(err)
Expand All @@ -56,7 +57,7 @@ func TestLoadX509KeyPair(t *testing.T) {
init: func(t *testing.T) (keyID, keyLabel, certID, certLabel string) {
t.Helper()
require := require.New(t)
prefix := t.TempDir()
prefix := uuid.New().String()
keyID, keyLabel, certID, certLabel = prefix+"keyID", prefix+"keyLabel", prefix+"certID", prefix+"certLabel"
pkcs11, err := crypto11.ConfigureFromFile(*configPath)
require.NoError(err)
Expand All @@ -73,7 +74,7 @@ func TestLoadX509KeyPair(t *testing.T) {
init: func(t *testing.T) (keyID, keyLabel, certID, certLabel string) {
t.Helper()
require := require.New(t)
prefix := t.TempDir()
prefix := uuid.New().String()
keyID, keyLabel, certID, certLabel = prefix+"keyID", prefix+"keyLabel", prefix+"certID", prefix+"certLabel"
pkcs11, err := crypto11.ConfigureFromFile(*configPath)
require.NoError(err)
Expand All @@ -90,7 +91,7 @@ func TestLoadX509KeyPair(t *testing.T) {
init: func(t *testing.T) (keyID, keyLabel, certID, certLabel string) {
t.Helper()
require := require.New(t)
prefix := t.TempDir()
prefix := uuid.New().String()
keyID, keyLabel, certID, certLabel = prefix+"keyID", prefix+"keyLabel", prefix+"certID", prefix+"certLabel"
pkcs11, err := crypto11.ConfigureFromFile(*configPath)
require.NoError(err)
Expand All @@ -108,7 +109,7 @@ func TestLoadX509KeyPair(t *testing.T) {
init: func(t *testing.T) (keyID, keyLabel, certID, certLabel string) {
t.Helper()
require := require.New(t)
prefix := t.TempDir()
prefix := uuid.New().String()
keyID, keyLabel, certID, certLabel = prefix+"keyID", prefix+"keyLabel", prefix+"certID", prefix+"certLabel"
pkcs11, err := crypto11.ConfigureFromFile(*configPath)
require.NoError(err)
Expand All @@ -133,7 +134,9 @@ func TestLoadX509KeyPair(t *testing.T) {
return
}
require.NoError(err)
defer cancel()
defer func() {
_ = cancel()
}()

assert.NotNil(crt.PrivateKey)
assert.NotNil(crt.Certificate)
Expand Down

0 comments on commit b7fa903

Please sign in to comment.