Skip to content

Commit 9e99baf

Browse files
author
Mauricio Bonetti
committed
issues/1449 - Enhance keyctl provider tests by enabling parallel execution for improved performance.
1 parent 2a9ba22 commit 9e99baf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/secrets/keyring/keyctl_linux.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type keyctlProvider struct {
1616
keys map[string]map[string]int // service -> key -> keyid mapping
1717
}
1818

19+
// NewKeyctlProvider creates a new keyring provider using Linux keyctl.
20+
// It initializes access to the user keyring for persistence across process invocations.
1921
func NewKeyctlProvider() (Provider, error) {
2022
// Use user keyring for persistence across process invocations
2123
ringID, err := unix.KeyctlGetKeyringID(unix.KEY_SPEC_USER_KEYRING, false)
@@ -138,6 +140,6 @@ func (k *keyctlProvider) IsAvailable() bool {
138140
return true
139141
}
140142

141-
func (k *keyctlProvider) Name() string {
143+
func (_ *keyctlProvider) Name() string {
142144
return "Linux Keyctl"
143145
}

pkg/secrets/keyring/keyctl_linux_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
func TestKeyctlProvider_Creation(t *testing.T) {
11+
t.Parallel()
1112
provider, err := NewKeyctlProvider()
1213
if err != nil {
1314
t.Skipf("Keyctl provider creation failed (may be expected in test environments): %v", err)
@@ -26,6 +27,7 @@ func TestKeyctlProvider_Creation(t *testing.T) {
2627
}
2728

2829
func TestKeyctlProvider_Name(t *testing.T) {
30+
t.Parallel()
2931
provider, err := NewKeyctlProvider()
3032
if err != nil {
3133
t.Skipf("Keyctl provider creation failed: %v", err)
@@ -39,6 +41,7 @@ func TestKeyctlProvider_Name(t *testing.T) {
3941
}
4042

4143
func TestKeyctlProvider_BasicOperations(t *testing.T) {
44+
t.Parallel()
4245
provider, err := NewKeyctlProvider()
4346
if err != nil {
4447
t.Skipf("Keyctl provider creation failed: %v", err)
@@ -55,6 +58,7 @@ func TestKeyctlProvider_BasicOperations(t *testing.T) {
5558
testValue := "test-value"
5659

5760
t.Run("Set and Get", func(t *testing.T) {
61+
t.Parallel()
5862
// Set a value
5963
err := provider.Set(testService, testKey, testValue)
6064
if err != nil {
@@ -73,6 +77,7 @@ func TestKeyctlProvider_BasicOperations(t *testing.T) {
7377
})
7478

7579
t.Run("Get_NotFound", func(t *testing.T) {
80+
t.Parallel()
7681
_, err := provider.Get("nonexistent-service", "nonexistent-key")
7782
if err == nil {
7883
t.Error("expected error for nonexistent key")
@@ -84,6 +89,7 @@ func TestKeyctlProvider_BasicOperations(t *testing.T) {
8489
})
8590

8691
t.Run("Delete", func(t *testing.T) {
92+
t.Parallel()
8793
// Delete the test key
8894
err := provider.Delete(testService, testKey)
8995
if err != nil {
@@ -124,6 +130,7 @@ func TestKeyctlProvider_BasicOperations(t *testing.T) {
124130
}
125131

126132
func TestKeyctlProvider_MultipleServices(t *testing.T) {
133+
t.Parallel()
127134
provider, err := NewKeyctlProvider()
128135
if err != nil {
129136
t.Skipf("Keyctl provider creation failed: %v", err)

0 commit comments

Comments
 (0)