summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-09-29 22:15:20 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-10-15 09:03:07 -0400
commit7e15d2ed3c01ab3c1f5f882fe8fa974058097bc6 (patch)
tree860f60d776890cf2b4c100053832b552cdef54d1 /src/tests
parent8c08a5e11f19cfe39695ee80793b72e2034c5aa4 (diff)
downloadsssd-7e15d2ed3c01ab3c1f5f882fe8fa974058097bc6.tar.gz
sssd-7e15d2ed3c01ab3c1f5f882fe8fa974058097bc6.tar.bz2
sssd-7e15d2ed3c01ab3c1f5f882fe8fa974058097bc6.zip
sysdb interface for adding incomplete groups
Useful for optimizing the initgroups operation.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/sysdb-tests.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 51eda8fd..b874544c 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -263,6 +263,15 @@ static int test_add_group(struct test_data *data)
return ret;
}
+static int test_add_incomplete_group(struct test_data *data)
+{
+ int ret;
+
+ ret = sysdb_add_incomplete_group(data->ctx->sysdb, data->ctx->domain,
+ data->groupname, data->gid);
+ return ret;
+}
+
static int test_store_group(struct test_data *data)
{
int ret;
@@ -717,6 +726,33 @@ START_TEST (test_sysdb_add_group)
}
END_TEST
+START_TEST (test_sysdb_add_incomplete_group)
+{
+ struct sysdb_test_ctx *test_ctx;
+ struct test_data *data;
+ int ret;
+
+ /* Setup */
+ ret = setup_sysdb_tests(&test_ctx);
+ if (ret != EOK) {
+ fail("Could not set up the test");
+ return;
+ }
+
+ data = talloc_zero(test_ctx, struct test_data);
+ data->ctx = test_ctx;
+ data->ev = test_ctx->ev;
+ data->uid = _i;
+ data->gid = _i;
+ data->groupname = talloc_asprintf(data, "testgroup%d", _i);
+
+ ret = test_add_incomplete_group(data);
+
+ fail_if(ret != EOK, "Could not add incomplete group %s", data->groupname);
+ talloc_free(test_ctx);
+}
+END_TEST
+
START_TEST (test_sysdb_getpwnam)
{
struct sysdb_test_ctx *test_ctx;
@@ -2776,6 +2812,10 @@ Suite *create_sysdb_suite(void)
/* test the ignore_not_found parameter for groups */
tcase_add_test(tc_sysdb, test_sysdb_remove_nonexistent_group);
+ /* Create incomplete groups - remove will fail if the LDB objects don't exist */
+ tcase_add_loop_test(tc_sysdb, test_sysdb_add_incomplete_group, 28000, 28010);
+ tcase_add_loop_test(tc_sysdb, test_sysdb_remove_local_group_by_gid, 28000, 28010);
+
/* test custom operations */
tcase_add_loop_test(tc_sysdb, test_sysdb_store_custom, 29010, 29020);
tcase_add_test(tc_sysdb, test_sysdb_search_custom_by_name);