summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-07-20 12:36:43 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-08-01 22:24:44 +0200
commitefea50efda58be66638e5d38c8e57fdf9992f204 (patch)
treed4083a388034417ee130369a9ffcc5c9052028fe /src/tests
parent87ed72b47859e673b636c85f35b85f1546c7ed3d (diff)
downloadsssd-efea50efda58be66638e5d38c8e57fdf9992f204.tar.gz
sssd-efea50efda58be66638e5d38c8e57fdf9992f204.tar.bz2
sssd-efea50efda58be66638e5d38c8e57fdf9992f204.zip
Change refreshing of subdomains
This patch keeps a local copy of the subdomains in the ipa subdomains plugin context. This has 2 advantages: 1. allows to check if anything changed w/o always hitting the sysdb. 2. later will allows us to dump this information w/o having to retrieve it again. The timestamp also allows to avoid refreshing too often.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/sysdb-tests.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 1eb9503f..d314baa9 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -3398,9 +3398,10 @@ START_TEST(test_sysdb_subdomain_create)
errno_t ret;
struct sysdb_subdom **cur_subdomains = NULL;
size_t cur_subdomains_count;
- struct sysdb_subdom *new_subdom1[] = { &dom1, NULL};
- struct sysdb_subdom *new_subdom2[] = { &dom2, NULL};
- struct sysdb_subdom *empty[] = { NULL};
+ struct sysdb_subdom *new_subdom1 = &dom1;
+ struct sysdb_subdom *new_subdom2 = &dom2;
+ int num_subdom1 = 1;
+ int num_subdom2 = 1;
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
@@ -3412,7 +3413,7 @@ START_TEST(test_sysdb_subdomain_create)
fail_unless(cur_subdomains != NULL, "No sub-domains returned.");
fail_unless(cur_subdomains[0] == NULL, "No empyt sub-domain list returned.");
- ret = sysdb_update_subdomains(test_ctx->sysdb, new_subdom1);
+ ret = sysdb_update_subdomains(test_ctx->sysdb, num_subdom1, new_subdom1);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3422,11 +3423,11 @@ START_TEST(test_sysdb_subdomain_create)
ret, strerror(ret));
fail_unless(cur_subdomains != NULL, "No sub-domains returned.");
fail_unless(cur_subdomains[0] != NULL, "Empyt sub-domain list returned.");
- fail_unless(strcmp(cur_subdomains[0]->name, new_subdom1[0]->name) == 0,
+ fail_unless(strcmp(cur_subdomains[0]->name, new_subdom1[0].name) == 0,
"Unexpected sub-domain found, expected [%s], got [%s]",
- new_subdom1[0]->name, cur_subdomains[0]->name);
+ new_subdom1[0].name, cur_subdomains[0]->name);
- ret = sysdb_update_subdomains(test_ctx->sysdb, new_subdom2);
+ ret = sysdb_update_subdomains(test_ctx->sysdb, num_subdom2, new_subdom2);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3436,11 +3437,11 @@ START_TEST(test_sysdb_subdomain_create)
ret, strerror(ret));
fail_unless(cur_subdomains != NULL, "No sub-domains returned.");
fail_unless(cur_subdomains[0] != NULL, "Empyt sub-domain list returned.");
- fail_unless(strcmp(cur_subdomains[0]->name, new_subdom2[0]->name) == 0,
+ fail_unless(strcmp(cur_subdomains[0]->name, new_subdom2[0].name) == 0,
"Unexpected sub-domain found, expected [%s], got [%s]",
- new_subdom2[0]->name, cur_subdomains[0]->name);
+ new_subdom2[0].name, cur_subdomains[0]->name);
- ret = sysdb_update_subdomains(test_ctx->sysdb, empty);
+ ret = sysdb_update_subdomains(test_ctx->sysdb, 0, NULL);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3457,7 +3458,8 @@ START_TEST(test_sysdb_subdomain_store_user)
{
struct sysdb_test_ctx *test_ctx;
errno_t ret;
- struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
+ struct sysdb_subdom *test_subdom = &dom_t;
+ int num_subdom = 1;
struct sss_domain_info *subdomain = NULL;
struct ldb_result *results = NULL;
struct ldb_dn *base_dn = NULL;
@@ -3466,7 +3468,7 @@ START_TEST(test_sysdb_subdomain_store_user)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_update_subdomains(test_ctx->sysdb, test_subdom);
+ ret = sysdb_update_subdomains(test_ctx->sysdb, num_subdom, test_subdom);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3512,7 +3514,8 @@ START_TEST(test_sysdb_subdomain_user_ops)
{
struct sysdb_test_ctx *test_ctx;
errno_t ret;
- struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
+ struct sysdb_subdom *test_subdom = &dom_t;
+ int num_subdom = 1;
struct sss_domain_info *subdomain = NULL;
struct ldb_message *msg = NULL;
struct ldb_dn *check_dn = NULL;
@@ -3520,7 +3523,7 @@ START_TEST(test_sysdb_subdomain_user_ops)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_update_subdomains(test_ctx->sysdb, test_subdom);
+ ret = sysdb_update_subdomains(test_ctx->sysdb, num_subdom, test_subdom);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3561,7 +3564,8 @@ START_TEST(test_sysdb_subdomain_group_ops)
{
struct sysdb_test_ctx *test_ctx;
errno_t ret;
- struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
+ struct sysdb_subdom *test_subdom = &dom_t;
+ int num_subdom = 1;
struct sss_domain_info *subdomain = NULL;
struct ldb_message *msg = NULL;
struct ldb_dn *check_dn = NULL;
@@ -3569,7 +3573,7 @@ START_TEST(test_sysdb_subdomain_group_ops)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_update_subdomains(test_ctx->sysdb, test_subdom);
+ ret = sysdb_update_subdomains(test_ctx->sysdb, num_subdom, test_subdom);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));