test_responder_cache_req.c revision 16212bbb2aaa55d0587515e72c0018479ae51be9
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina Pavel Březina <pbrezina@redhat.com>
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina Copyright (C) 2014 Red Hat
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina This program is free software; you can redistribute it and/or modify
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina it under the terms of the GNU General Public License as published by
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina the Free Software Foundation; either version 3 of the License, or
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina (at your option) any later version.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina This program is distributed in the hope that it will be useful,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina GNU General Public License for more details.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina You should have received a copy of the GNU General Public License
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina#include "responder/common/responder_cache_req.h"
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina#define TEST_CONF_DB "test_responder_cache_req_conf.ldb"
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina#define TEST_DOM_NAME "responder_cache_req_test"
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_ ## test, \
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_ ## test, \
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina#define run_cache_req(ctx, send_fn, done_fn, dom, crp, lookup, expret) do { \
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina req_mem_ctx = talloc_new(global_talloc_context); \
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina req = send_fn(req_mem_ctx, ctx->tctx->ev, ctx->rctx, \
5928fcbb57b92bfd18ad15aaaf4a5e1ab8dabe61Petr Cech /* NOTE: Please, instead of adding new create_[user|group] bool,
5928fcbb57b92bfd18ad15aaaf4a5e1ab8dabe61Petr Cech * use bitshift. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březinaconst char *domains[] = {"responder_cache_req_test_a",
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina "responder_cache_req_test_b",
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina "responder_cache_req_test_c",
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina "responder_cache_req_test_d",
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březinastruct cli_protocol_version *register_cli_protocol_version(void)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina static struct cli_protocol_version version[] = {
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinastatic void cache_req_user_by_name_test_done(struct tevent_req *req)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina ctx = tevent_req_callback_data(req, struct cache_req_test_ctx);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina ctx->tctx->error = cache_req_user_by_name_recv(ctx, req,
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinastatic void cache_req_user_by_id_test_done(struct tevent_req *req)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina ctx = tevent_req_callback_data(req, struct cache_req_test_ctx);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina ctx->tctx->error = cache_req_user_by_id_recv(ctx, req,
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinastatic void cache_req_group_by_name_test_done(struct tevent_req *req)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina ctx = tevent_req_callback_data(req, struct cache_req_test_ctx);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina ctx->tctx->error = cache_req_group_by_name_recv(ctx, req,
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinastatic void cache_req_group_by_id_test_done(struct tevent_req *req)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina ctx = tevent_req_callback_data(req, struct cache_req_test_ctx);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina ctx->tctx->error = cache_req_group_by_id_recv(ctx, req,
c4d4fe1603420fe8f3d256a3a446974699563ff3Petr Cechstatic void prepare_concrete_user(TALLOC_CTX *mem_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sysdb_attrs_add_string(attrs, SYSDB_UPN, TEST_UPN);
c4d4fe1603420fe8f3d256a3a446974699563ff3Petr Cech prepare_concrete_user(mem_ctx, domain, TEST_USER_NAME, TEST_USER_ID,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březinastatic void run_user_by_name(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_cache_req(test_ctx, cache_req_user_by_name_send,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina cache_refresh_percent, TEST_USER_NAME, exp_ret);
6c2e507bd1571f9c7e26c5c9d60753b29fb75578Jakub Hrozekstatic void run_user_by_upn(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_cache_req(test_ctx, cache_req_user_by_name_send,
6c2e507bd1571f9c7e26c5c9d60753b29fb75578Jakub Hrozekstatic void run_user_by_id(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_cache_req(test_ctx, cache_req_user_by_id_send,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina cache_refresh_percent, TEST_USER_ID, exp_ret);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březinastatic void check_user(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ldbupn = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ldbuid = ldb_msg_find_attr_as_uint(test_ctx->result->msgs[0],
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina assert_string_equal(exp_dom->name, test_ctx->domain->name);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sysdb_store_group(domain, TEST_GROUP_NAME, TEST_GROUP_ID, NULL,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březinastatic void run_group_by_name(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_cache_req(test_ctx, cache_req_group_by_name_send,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina cache_refresh_percent, TEST_GROUP_NAME, exp_ret);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březinastatic void run_group_by_id(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_cache_req(test_ctx, cache_req_group_by_id_send,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina cache_refresh_percent, TEST_GROUP_ID, exp_ret);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březinastatic void check_group(struct cache_req_test_ctx *test_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina assert_string_equal(ldbname, TEST_GROUP_NAME);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ldbgid = ldb_msg_find_attr_as_uint(test_ctx->result->msgs[0],
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina assert_string_equal(exp_dom->name, test_ctx->domain->name);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina__wrap_sss_dp_get_account_send(TALLOC_CTX *mem_ctx,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ctx = sss_mock_ptr_type(struct cache_req_test_ctx*);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(ctx, ctx->tctx->dom, 1000, time(NULL));
c4d4fe1603420fe8f3d256a3a446974699563ff3Petr Cech prepare_concrete_user(mem_ctx, ctx->tctx->dom, TEST_USER_NAME2,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sysdb_store_group(ctx->tctx->dom, TEST_GROUP_NAME,
5928fcbb57b92bfd18ad15aaaf4a5e1ab8dabe61Petr Cech ret = sysdb_store_group(ctx->tctx->dom, TEST_GROUP_NAME2,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina return test_req_succeed_send(mem_ctx, rctx->ev);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_single_domain_setup(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_zero(NULL, struct cache_req_test_ctx);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx->tctx = create_dom_test_ctx(test_ctx, TESTS_PATH, TEST_CONF_DB,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx->rctx = mock_rctx(test_ctx, test_ctx->tctx->ev,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina ret = sss_ncache_init(test_ctx, &test_ctx->ncache);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_single_domain_teardown(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, TEST_DOM_NAME);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_multi_domain_setup(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_zero(NULL, struct cache_req_test_ctx);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx->tctx = create_multidom_test_ctx(test_ctx, TESTS_PATH,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx->rctx = mock_rctx(test_ctx, test_ctx->tctx->ev,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina ret = sss_ncache_init(test_ctx, &test_ctx->ncache);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_multi_domain_teardown(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_multidom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, domains);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_multiple_domains_found(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, domain, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return_always(sss_dp_get_account_recv, 0);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_multiple_domains_notfound(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return_always(sss_dp_get_account_recv, 0);
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březinavoid test_user_by_name_multiple_domains_parse(void **state)
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Add user to the first domain with different uid then test user. */
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina "responder_cache_req_test_a", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sysdb_store_user(domain, name, "pwd", 2000, 1000,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina NULL, NULL, NULL, "cn=test-user,dc=test", NULL,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Add test user to the last domain. */
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, domain, 1000, time(NULL));
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina /* Append domain name to the username. */
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina fqn = talloc_asprintf(test_ctx, "%s@%s", name,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina "responder_cache_req_test_d");
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina mock_parse_inp(name, "responder_cache_req_test_d", ERR_OK);
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina req_mem_ctx = talloc_new(global_talloc_context);
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina req = cache_req_user_by_name_send(req_mem_ctx, test_ctx->tctx->ev,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina tevent_req_set_callback(req, cache_req_user_by_name_test_done, test_ctx);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_cache_valid(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_name(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_cache_expired(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, -1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina /* DP should be contacted */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_name(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_cache_midpoint(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, 50, time(NULL) - 26);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina /* DP should be contacted without callback */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_name(test_ctx, test_ctx->tctx->dom, 50, ERR_OK);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina ret = sss_ncache_set_user(test_ctx->ncache, false,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_name(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_missing_found(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_name(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březinavoid test_user_by_name_missing_notfound(void **state)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_name(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březinavoid test_user_by_upn_multiple_domains_found(void **state)
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, domain, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return_always(sss_dp_get_account_recv, 0);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březinavoid test_user_by_upn_multiple_domains_notfound(void **state)
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return_always(sss_dp_get_account_recv, 0);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březinavoid test_user_by_upn_cache_valid(void **state)
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březinavoid test_user_by_upn_cache_expired(void **state)
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, -1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina /* DP should be contacted */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březinavoid test_user_by_upn_cache_midpoint(void **state)
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, 50, time(NULL) - 26);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina /* DP should be contacted without callback */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina ret = sss_ncache_set_user(test_ctx->ncache, false,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březinavoid test_user_by_upn_missing_found(void **state)
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březinavoid test_user_by_upn_missing_notfound(void **state)
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(NULL, NULL, ERR_DOMAIN_NOT_FOUND);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinavoid test_user_by_id_multiple_domains_found(void **state)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, domain, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return_always(sss_dp_get_account_recv, 0);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinavoid test_user_by_id_multiple_domains_notfound(void **state)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return_always(sss_dp_get_account_recv, 0);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_id(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinavoid test_user_by_id_cache_expired(void **state)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, -1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* DP should be contacted. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_id(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinavoid test_user_by_id_cache_midpoint(void **state)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_user(test_ctx, test_ctx->tctx->dom, 50, time(NULL) - 26);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina /* DP should be contacted without callback */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_id(test_ctx, test_ctx->tctx->dom, 50, ERR_OK);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup user. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sss_ncache_set_uid(test_ctx->ncache, false, NULL, TEST_USER_ID);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_id(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinavoid test_user_by_id_missing_found(void **state)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_id(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březinavoid test_user_by_id_missing_notfound(void **state)
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_user_by_id(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_multiple_domains_found(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, domain, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return_always(sss_dp_get_account_recv, 0);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina mock_parse_inp(TEST_GROUP_NAME, NULL, ERR_OK);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_multiple_domains_notfound(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return_always(sss_dp_get_account_recv, 0);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina mock_parse_inp(TEST_GROUP_NAME, NULL, ERR_OK);
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březinavoid test_group_by_name_multiple_domains_parse(void **state)
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Add group to the first domain. */
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina "responder_cache_req_test_a", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sysdb_store_group(domain, name, 2000, NULL,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Add group to the last domain, with different gid. */
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, domain, 1000, time(NULL));
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina /* Append domain name to the username. */
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina fqn = talloc_asprintf(test_ctx, "%s@%s", name,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina "responder_cache_req_test_d");
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina req_mem_ctx = talloc_new(global_talloc_context);
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina mock_parse_inp(name, "responder_cache_req_test_d", ERR_OK);
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina req = cache_req_group_by_name_send(req_mem_ctx, test_ctx->tctx->ev,
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina tevent_req_set_callback(req, cache_req_group_by_name_test_done, test_ctx);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_cache_valid(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, test_ctx->tctx->dom, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_name(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_cache_expired(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, test_ctx->tctx->dom, -1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina /* DP should be contacted */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_name(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_cache_midpoint(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, test_ctx->tctx->dom, 50, time(NULL) - 26);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina /* DP should be contacted without callback */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_name(test_ctx, test_ctx->tctx->dom, 50, ERR_OK);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina ret = sss_ncache_set_group(test_ctx->ncache, false,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_name(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_missing_found(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_name(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
641d684ee88c6540a4cf1d74d258614f615699fePavel Březinavoid test_group_by_name_missing_notfound(void **state)
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_name(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_multiple_domains_found(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina domain = find_domain_by_name(test_ctx->tctx->dom,
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina "responder_cache_req_test_d", true);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, domain, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return_always(sss_dp_get_account_recv, 0);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_multiple_domains_notfound(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return_always(__wrap_sss_dp_get_account_send, test_ctx);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return_always(sss_dp_get_account_recv, 0);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_cache_valid(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, test_ctx->tctx->dom, 1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_id(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_cache_expired(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, test_ctx->tctx->dom, -1000, time(NULL));
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina /* DP should be contacted */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_id(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_cache_midpoint(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina prepare_group(test_ctx, test_ctx->tctx->dom, 50, time(NULL) - 26);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina /* DP should be contacted without callback */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_id(test_ctx, test_ctx->tctx->dom, 50, ERR_OK);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Setup group. */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina ret = sss_ncache_set_gid(test_ctx->ncache, false, NULL, TEST_GROUP_ID);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_id(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_missing_found(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_id(test_ctx, test_ctx->tctx->dom, 0, ERR_OK);
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březinavoid test_group_by_id_missing_notfound(void **state)
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Mock values. */
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina will_return(__wrap_sss_dp_get_account_send, test_ctx);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina run_group_by_id(test_ctx, test_ctx->tctx->dom, 0, ENOENT);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekstatic void cache_req_user_by_filter_test_done(struct tevent_req *req)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek ctx = tevent_req_callback_data(req, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek ctx->tctx->error = cache_req_user_by_filter_recv(ctx, req,
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cechvoid test_user_by_recent_filter_valid(void **state)
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech ret = sysdb_store_user(test_ctx->tctx->dom, TEST_USER_NAME2,
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech /* Filters always go to DP */
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech will_return(__wrap_sss_dp_get_account_send, test_ctx);
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech /* User TEST_USER is created with a DP callback. */
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech req = cache_req_user_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech tevent_req_set_callback(req, cache_req_user_by_filter_test_done, test_ctx);
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cechvoid test_users_by_recent_filter_valid(void **state)
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech ret = sysdb_store_user(test_ctx->tctx->dom, TEST_USER_NAME3,
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech /* Filters always go to DP */
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech will_return(__wrap_sss_dp_get_account_send, test_ctx);
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech /* User TEST_USER1 and TEST_USER2 are created with a DP callback. */
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech req = cache_req_user_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech tevent_req_set_callback(req, cache_req_user_by_filter_test_done, test_ctx);
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech user_names = talloc_array(test_ctx, const char *, 2);
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech ldb_results = talloc_array(test_ctx, const char *, 2);
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech for (int i = 0; i < 2; ++i) {
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[i],
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech assert_string_not_equal(ldb_results[0], ldb_results[1]);
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech assert_true(tc_are_values_in_array(user_names, ldb_results));
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekvoid test_users_by_filter_filter_old(void **state)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek /* This user was updated in distant past, so it wont't be reported by
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek * the filter search */
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek ret = sysdb_store_user(test_ctx->tctx->dom, TEST_USER_NAME2, "pwd", 1001, 1001,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek NULL, NULL, NULL, "cn="TEST_USER_NAME2",dc=test", NULL,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req_mem_ctx = talloc_new(global_talloc_context);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek /* Filters always go to DP */
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek will_return(__wrap_sss_dp_get_account_send, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req = cache_req_user_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek tevent_req_set_callback(req, cache_req_user_by_filter_test_done, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekvoid test_users_by_filter_notfound(void **state)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req_mem_ctx = talloc_new(global_talloc_context);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek /* Filters always go to DP */
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek will_return(__wrap_sss_dp_get_account_send, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req = cache_req_user_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek "nosuchuser*");
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek tevent_req_set_callback(req, cache_req_user_by_filter_test_done, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekstatic void test_users_by_filter_multiple_domains_notfound(void **state)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek domain = find_domain_by_name(test_ctx->tctx->dom,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek "responder_cache_req_test_d", true);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req_mem_ctx = talloc_new(global_talloc_context);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek /* Filters always go to DP */
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek will_return(__wrap_sss_dp_get_account_send, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req = cache_req_user_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek "nosuchuser*");
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek tevent_req_set_callback(req, cache_req_user_by_filter_test_done, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekstatic void cache_req_group_by_filter_test_done(struct tevent_req *req)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek ctx = tevent_req_callback_data(req, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek ctx->tctx->error = cache_req_group_by_filter_recv(ctx, req,
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cechvoid test_group_by_recent_filter_valid(void **state)
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech ret = sysdb_store_group(test_ctx->tctx->dom, TEST_GROUP_NAME2,
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech /* Filters always go to DP */
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech will_return(__wrap_sss_dp_get_account_send, test_ctx);
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech /* Group TEST_GROUP is created with a DP callback. */
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech req = cache_req_group_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech tevent_req_set_callback(req, cache_req_group_by_filter_test_done, test_ctx);
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cechvoid test_groups_by_recent_filter_valid(void **state)
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech ret = sysdb_store_group(test_ctx->tctx->dom, TEST_GROUP_NAME2,
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech /* Filters always go to DP */
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech will_return(__wrap_sss_dp_get_account_send, test_ctx);
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech /* Group TEST_GROUP1 and TEST_GROUP2 are created with a DP callback. */
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech req = cache_req_group_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech tevent_req_set_callback(req, cache_req_group_by_filter_test_done, test_ctx);
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech group_names = talloc_array(tmp_ctx, const char *, 2);
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech ldb_results = talloc_array(tmp_ctx, const char *, 2);
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech for (int i = 0; i < 2; ++i) {
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[i],
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech assert_string_not_equal(ldb_results[0], ldb_results[1]);
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech assert_true(tc_are_values_in_array(group_names, ldb_results));
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekvoid test_groups_by_filter_notfound(void **state)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req_mem_ctx = talloc_new(global_talloc_context);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek /* Filters always go to DP */
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek will_return(__wrap_sss_dp_get_account_send, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req = cache_req_group_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek "nosuchgroup*");
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek tevent_req_set_callback(req, cache_req_group_by_filter_test_done, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozekvoid test_groups_by_filter_multiple_domains_notfound(void **state)
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek domain = find_domain_by_name(test_ctx->tctx->dom,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek "responder_cache_req_test_d", true);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req_mem_ctx = talloc_new(global_talloc_context);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek /* Filters always go to DP */
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek will_return(__wrap_sss_dp_get_account_send, test_ctx);
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek req = cache_req_group_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek "nosuchgroup*");
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek tevent_req_set_callback(req, cache_req_group_by_filter_test_done, test_ctx);
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březina new_single_domain_test(user_by_name_cache_valid),
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březina new_single_domain_test(user_by_name_cache_expired),
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březina new_single_domain_test(user_by_name_cache_midpoint),
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březina new_single_domain_test(user_by_name_missing_found),
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březina new_single_domain_test(user_by_name_missing_notfound),
54ed1b1214dbf9da1f481e8d193c81ce4312516bPavel Březina new_multi_domain_test(user_by_name_multiple_domains_found),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_multi_domain_test(user_by_name_multiple_domains_notfound),
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina new_multi_domain_test(user_by_name_multiple_domains_parse),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_single_domain_test(user_by_upn_cache_valid),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_single_domain_test(user_by_upn_cache_expired),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_single_domain_test(user_by_upn_cache_midpoint),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_single_domain_test(user_by_upn_missing_found),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_single_domain_test(user_by_upn_missing_notfound),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_multi_domain_test(user_by_upn_multiple_domains_found),
28ebfa4373d1e7ce45b5d70a3619df1c074a661ePavel Březina new_multi_domain_test(user_by_upn_multiple_domains_notfound),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_single_domain_test(user_by_id_cache_valid),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_single_domain_test(user_by_id_cache_expired),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_single_domain_test(user_by_id_cache_midpoint),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_single_domain_test(user_by_id_missing_found),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_single_domain_test(user_by_id_missing_notfound),
3a5ea81007bd38ce511c37f65cc45d4b6b95ec44Pavel Březina new_multi_domain_test(user_by_id_multiple_domains_found),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_multi_domain_test(user_by_id_multiple_domains_notfound),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_single_domain_test(group_by_name_cache_valid),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_single_domain_test(group_by_name_cache_expired),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_single_domain_test(group_by_name_cache_midpoint),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_single_domain_test(group_by_name_missing_found),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_single_domain_test(group_by_name_missing_notfound),
641d684ee88c6540a4cf1d74d258614f615699fePavel Březina new_multi_domain_test(group_by_name_multiple_domains_found),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_multi_domain_test(group_by_name_multiple_domains_notfound),
e87b2a6e94c1066b3044fe683825ff5b4f8716c2Pavel Březina new_multi_domain_test(group_by_name_multiple_domains_parse),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_single_domain_test(group_by_id_cache_valid),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_single_domain_test(group_by_id_cache_expired),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_single_domain_test(group_by_id_cache_midpoint),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_single_domain_test(group_by_id_missing_found),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_single_domain_test(group_by_id_missing_notfound),
71965bb18407ff45ada9e47cb6def086e48663c6Pavel Březina new_multi_domain_test(group_by_id_multiple_domains_found),
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek new_multi_domain_test(group_by_id_multiple_domains_notfound),
da79bee1472a06b89be2df903fb0bd8ce600c610Petr Cech new_single_domain_test(user_by_recent_filter_valid),
a6a5a08a357d2adbb653b81bacc602ca3543c4c4Petr Cech new_single_domain_test(users_by_recent_filter_valid),
fe6dd669d1e8606862879127f92c177bb7fdc1bdPetr Cech new_single_domain_test(group_by_recent_filter_valid),
16212bbb2aaa55d0587515e72c0018479ae51be9Petr Cech new_single_domain_test(groups_by_recent_filter_valid),
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek new_single_domain_test(users_by_filter_filter_old),
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek new_single_domain_test(users_by_filter_notfound),
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek new_multi_domain_test(users_by_filter_multiple_domains_notfound),
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek new_single_domain_test(groups_by_filter_notfound),
fd04b25eaa5cd105da4122854d8bc1e702760e60Jakub Hrozek new_multi_domain_test(groups_by_filter_multiple_domains_notfound),
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina /* Set debug level to invalid value so we can deside if -d 0 was used. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina pc = poptGetContext(argv[0], argc, argv, long_options, 0);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina fprintf(stderr, "\nInvalid option %s: %s\n\n",
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina /* Even though normally the tests should clean up after themselves
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * they might not after a failed run. Remove the old db to be sure */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_multidom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, domains);
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, TEST_DOM_NAME);