]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Use unique directory for base_dir for unit tests
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 23 Mar 2026 19:31:59 +0000 (21:31 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 25 Mar 2026 08:33:45 +0000 (10:33 +0200)
Otherwise auth-token-secret.dat might get clobbered by other
tests when running in parallel.

src/auth/test-auth.c

index 6035b095e55ba6c6b0682b182ba67fd67661d8b7..61eb3c057b81e3faa614e24b6783e000c6160944 100644 (file)
@@ -1,6 +1,7 @@
 /* Copyright (c) 2024 Dovecot authors, see the included COPYING file */
 
 #include "test-auth.h"
+#include "test-dir.h"
 #include "auth-common.h"
 #include "settings.h"
 #include "auth-settings.h"
@@ -14,7 +15,6 @@
 #include <time.h>
 
 static const char *const settings[] = {
-       "base_dir", ".",
        "auth_mechanisms",
                "ANONYMOUS APOP CRAM-MD5 DIGEST-MD5 EXTERNAL LOGIN PLAIN OTP "
                "OAUTHBEARER SCRAM-SHA-1 SCRAM-SHA-256 XOAUTH2",
@@ -47,8 +47,10 @@ void test_auth_init(void)
 {
        const char *const protocols[] = {NULL};
        process_start_time = time(NULL);
+       test_dir_init("test-auth");
 
        settings_simple_init(&simple_set, settings);
+       settings_override(simple_set.instance, "base_dir", test_dir_get(), SETTINGS_OVERRIDE_TYPE_CLI_PARAM);
        global_auth_settings = settings_get_or_fatal(simple_set.event,
                                                     &auth_setting_parser_info);
        /* this is needed to get oauth2 initialized */