mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
7ecfd1aa07
This change ensures keyring tests that utilize the real OS keyring use credentials that are isolated by process ID so that parallel test processes do not access the same credentials. https://github.com/coder/internal/issues/1192
16 lines
401 B
Go
16 lines
401 B
Go
package testhelpers
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// KeyringServiceName generates a test service name for use with the OS keyring.
|
|
// It intends to prevent keyring usage collisions between parallel tests within a
|
|
// process and parallel test processes (which may occur on CI).
|
|
func KeyringServiceName(t *testing.T) string {
|
|
t.Helper()
|
|
return t.Name() + "_" + fmt.Sprintf("%v", os.Getpid())
|
|
}
|