summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Čech <pcech@redhat.com>2017-01-12 13:16:10 +0100
committerJakub Hrozek <jhrozek@redhat.com>2017-02-08 10:53:27 +0100
commitf1e3364a72eb75673d10cf8c97ba8f1d7a385405 (patch)
tree5d249c9463253f189904755a7d78be51251f2b24
parent3ee411625aee19afda7477bb10b52c3da378b6fb (diff)
TEST: create_multidom_test_ctx() extending
Function create_multidom_test_ctx() prepares test environment for multidomains. This patch enables setting of different params for each domain. Resolves: https://fedorahosted.org/sssd/ticket/3230 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com>
-rw-r--r--src/tests/cmocka/test_ad_common.c5
-rw-r--r--src/tests/cmocka/test_sysdb_subdomains.c5
-rw-r--r--src/tests/cmocka/test_sysdb_ts_cache.c5
-rw-r--r--src/tests/common.h2
-rw-r--r--src/tests/common_dom.c6
5 files changed, 7 insertions, 16 deletions
diff --git a/src/tests/cmocka/test_ad_common.c b/src/tests/cmocka/test_ad_common.c
index 7ec292092..ea9998951 100644
--- a/src/tests/cmocka/test_ad_common.c
+++ b/src/tests/cmocka/test_ad_common.c
@@ -78,9 +78,6 @@ struct ad_sysdb_test_ctx {
static int test_ad_sysdb_setup(void **state)
{
struct ad_sysdb_test_ctx *test_ctx;
- struct sss_test_conf_param params[] = {
- { NULL, NULL }, /* Sentinel */
- };
assert_true(leak_check_setup());
@@ -92,7 +89,7 @@ static int test_ad_sysdb_setup(void **state)
test_ctx->tctx = create_multidom_test_ctx(test_ctx, TESTS_PATH,
TEST_CONF_DB, domains,
- TEST_ID_PROVIDER, params);
+ TEST_ID_PROVIDER, NULL);
assert_non_null(test_ctx->tctx);
*state = test_ctx;
diff --git a/src/tests/cmocka/test_sysdb_subdomains.c b/src/tests/cmocka/test_sysdb_subdomains.c
index 52242e516..49f44998a 100644
--- a/src/tests/cmocka/test_sysdb_subdomains.c
+++ b/src/tests/cmocka/test_sysdb_subdomains.c
@@ -60,9 +60,6 @@ struct subdom_test_ctx {
static int test_sysdb_subdom_setup(void **state)
{
struct subdom_test_ctx *test_ctx;
- struct sss_test_conf_param params[] = {
- { NULL, NULL }, /* Sentinel */
- };
assert_true(leak_check_setup());
@@ -74,7 +71,7 @@ static int test_sysdb_subdom_setup(void **state)
test_ctx->tctx = create_multidom_test_ctx(test_ctx, TESTS_PATH,
TEST_CONF_DB, domains,
- TEST_ID_PROVIDER, params);
+ TEST_ID_PROVIDER, NULL);
assert_non_null(test_ctx->tctx);
*state = test_ctx;
diff --git a/src/tests/cmocka/test_sysdb_ts_cache.c b/src/tests/cmocka/test_sysdb_ts_cache.c
index e950f8863..f5aab73f0 100644
--- a/src/tests/cmocka/test_sysdb_ts_cache.c
+++ b/src/tests/cmocka/test_sysdb_ts_cache.c
@@ -74,9 +74,6 @@ const char *domains[] = { TEST_DOM1_NAME,
static int test_sysdb_ts_setup(void **state)
{
struct sysdb_ts_test_ctx *test_ctx;
- struct sss_test_conf_param params[] = {
- { NULL, NULL }, /* Sentinel */
- };
assert_true(leak_check_setup());
@@ -88,7 +85,7 @@ static int test_sysdb_ts_setup(void **state)
test_ctx->tctx = create_multidom_test_ctx(test_ctx, TESTS_PATH,
TEST_CONF_DB, domains,
- TEST_ID_PROVIDER, params);
+ TEST_ID_PROVIDER, NULL);
assert_non_null(test_ctx->tctx);
check_leaks_push(test_ctx);
diff --git a/src/tests/common.h b/src/tests/common.h
index b49cfea9b..c06568d38 100644
--- a/src/tests/common.h
+++ b/src/tests/common.h
@@ -92,7 +92,7 @@ create_multidom_test_ctx(TALLOC_CTX *mem_ctx,
const char *cdb_file,
const char **domains,
const char *id_provider,
- struct sss_test_conf_param *params);
+ struct sss_test_conf_param **params);
struct sss_test_ctx *
create_dom_test_ctx(TALLOC_CTX *mem_ctx,
diff --git a/src/tests/common_dom.c b/src/tests/common_dom.c
index f1a92cc99..def28d510 100644
--- a/src/tests/common_dom.c
+++ b/src/tests/common_dom.c
@@ -231,7 +231,7 @@ create_multidom_test_ctx(TALLOC_CTX *mem_ctx,
const char *cdb_file,
const char **domains,
const char *id_provider,
- struct sss_test_conf_param *params)
+ struct sss_test_conf_param **params)
{
struct sss_domain_info *domain = NULL;
struct sss_test_ctx *test_ctx = NULL;
@@ -255,7 +255,7 @@ create_multidom_test_ctx(TALLOC_CTX *mem_ctx,
/* create confdb objects for the domains */
for (i = 0; domains[i] != NULL; i++) {
ret = mock_confdb_domain(test_ctx, test_ctx->confdb, tests_path,
- domains[i], id_provider, params,
+ domains[i], id_provider, params != NULL ? params[i] : NULL,
(cdb_path == NULL ? &cdb_path : NULL));
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, "Unable to initialize confdb domain "
@@ -302,7 +302,7 @@ create_dom_test_ctx(TALLOC_CTX *mem_ctx,
const char *domains[] = {domain_name, NULL};
return create_multidom_test_ctx(mem_ctx, tests_path, confdb_path, domains,
- id_provider, params);
+ id_provider, &params);
}
void test_multidom_suite_cleanup(const char *tests_path,