From efe85f9cfed51a4b0b3f43d7894a4ccca280d859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 20 Dec 2024 02:40:58 +0000 Subject: [PATCH] pam/integration-tests: Use a shared authd instance only in race mode by default In case, the env variable AUTHD_TESTS_USE_SHARED_AUTHD_INSTANCES can be set to force it even in non-race test runs --- pam/integration-tests/helpers_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pam/integration-tests/helpers_test.go b/pam/integration-tests/helpers_test.go index 16ab12351..bae438f1a 100644 --- a/pam/integration-tests/helpers_test.go +++ b/pam/integration-tests/helpers_test.go @@ -81,7 +81,12 @@ func runAuthd(t *testing.T, gpasswdOutput, groupsFile string, currentUserAsRoot func sharedAuthd(t *testing.T) (socketPath string, gpasswdFile string) { t.Helper() - if os.Getenv("AUTHD_TESTS_USE_INDIVIDUAL_AUTHD_INSTANCES") != "" { + sharedInstance := testutils.IsRace() + if s, err := strconv.ParseBool(os.Getenv("AUTHD_TESTS_USE_SHARED_AUTHD_INSTANCES")); err == nil { + sharedInstance = s + } + + if !sharedInstance { gPasswd := filepath.Join(t.TempDir(), "gpasswd.output") groups := filepath.Join(testutils.TestFamilyPath(t), "gpasswd.group") socket, cleanup, _ := runAuthdForTesting(t, gPasswd, groups, true)