From c97cabcd1c7a41e1ecc2a9e80a0677ce1f17229c Mon Sep 17 00:00:00 2001 From: Timo Sirainen <timo.sirainen@open-xchange.com> Date: Thu, 2 Nov 2023 15:31:49 +0200 Subject: [PATCH] testsuite: Adjust to lib-storage API changes --- src/lib-sieve-tool/sieve-tool.c | 9 +++++++-- src/testsuite/testsuite-mailstore.c | 15 ++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/lib-sieve-tool/sieve-tool.c b/src/lib-sieve-tool/sieve-tool.c index 7ddc9937a..35a684e97 100644 --- a/src/lib-sieve-tool/sieve-tool.c +++ b/src/lib-sieve-tool/sieve-tool.c @@ -353,10 +353,15 @@ void sieve_tool_init_mail_user(struct sieve_tool *tool, struct settings_instance *set_instance = mail_storage_service_user_get_settings_instance(mail_user_dovecot->service_user); + const char *const code_override_fields[] = { + t_strdup_printf("mail_location=%s", mail_location), + NULL, + }; struct mail_storage_service_input input = { .username = username, .set_instance = set_instance, .no_userdb_lookup = TRUE, + .code_override_fields = code_override_fields, }; if (mail_storage_service_lookup_next(tool->storage_service, &input, &tool->mail_user, &errstr) < 0) @@ -368,8 +373,8 @@ void sieve_tool_init_mail_user(struct sieve_tool *tool, if (mail_user_init(tool->mail_user, &errstr) < 0) i_fatal("Test user initialization failed: %s", errstr); - if (mail_namespaces_init_location(tool->mail_user, mail_location, - &errstr) < 0) + if (mail_namespaces_init_location(tool->mail_user, + tool->mail_user->event, &errstr) < 0) i_fatal("Test storage creation failed: %s", errstr); ns = tool->mail_user->namespaces; diff --git a/src/testsuite/testsuite-mailstore.c b/src/testsuite/testsuite-mailstore.c index ce7cb1703..a703e850b 100644 --- a/src/testsuite/testsuite-mailstore.c +++ b/src/testsuite/testsuite-mailstore.c @@ -64,7 +64,6 @@ void testsuite_mailstore_init(void) struct mail_user *mail_user_dovecot, *mail_user; struct mail_namespace *ns; struct mail_namespace_settings *ns_set; - struct mail_storage_settings *mail_set; const char *tmpdir, *error, *cwd; tmpdir = testsuite_tmp_dir_get(); @@ -84,6 +83,8 @@ void testsuite_mailstore_init(void) i_fatal("Failed to get working directory: %s", error); const char *const userdb_fields[] = { t_strconcat("home=", cwd, NULL), + t_strconcat("mail_location=maildir:", + testsuite_mailstore_location, NULL), "mail_attribute/dict_driver=file", t_strconcat("dict_file_path=", testsuite_mailstore_attrs, NULL), NULL, @@ -103,21 +104,13 @@ void testsuite_mailstore_init(void) mail_user->autocreated = TRUE; ns_set = p_new(mail_user->pool, struct mail_namespace_settings, 1); - ns_set->location = testsuite_mailstore_location; ns_set->separator = "."; ns = mail_namespaces_init_empty(mail_user); ns->flags |= NAMESPACE_FLAG_INBOX_USER; ns->set = ns_set; - /* absolute paths are ok with raw storage */ - mail_set = p_new(mail_user->pool, struct mail_storage_settings, 1); - *mail_set = *ns->mail_set; - mail_set->mail_location = p_strconcat( - mail_user->pool, "maildir:", - testsuite_mailstore_location, NULL); - ns->mail_set = mail_set; - - if (mail_storage_create(ns, "maildir", 0, &error) < 0) + + if (mail_storage_create(ns, mail_user->event, 0, &error) < 0) i_fatal("Couldn't create testsuite storage: %s", error); if (mail_namespaces_init_finish(ns, &error) < 0) i_fatal("Couldn't create testsuite namespace: %s", error); -- GitLab