summaryrefslogtreecommitdiffstats
path: root/server/tests/sysdb-tests.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-02-13 14:17:24 -0500
committerSimo Sorce <idra@samba.org>2009-02-13 14:17:24 -0500
commit224a0dfad69c2e056f19e2b4865d592f495fb944 (patch)
tree7a3e266a11ad9f8f6279592dad1d5ee8b901bd0b /server/tests/sysdb-tests.c
parentb794a3bae0ed6b8ce7e0762a36f0e58d8f8d8776 (diff)
downloadsssd-224a0dfad69c2e056f19e2b4865d592f495fb944.tar.gz
sssd-224a0dfad69c2e056f19e2b4865d592f495fb944.tar.xz
sssd-224a0dfad69c2e056f19e2b4865d592f495fb944.zip
Always pass teh database path explicitly, so that test cases can use
throw away databases Check version and init main db if empty
Diffstat (limited to 'server/tests/sysdb-tests.c')
-rw-r--r--server/tests/sysdb-tests.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index bb222fae2..a24ae1819 100644
--- a/server/tests/sysdb-tests.c
+++ b/server/tests/sysdb-tests.c
@@ -39,6 +39,7 @@ struct sysdb_test_ctx {
static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
{
struct sysdb_test_ctx *test_ctx;
+ char *conf_db;
int ret;
test_ctx = talloc_zero(NULL, struct sysdb_test_ctx);
@@ -57,15 +58,24 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
return EIO;
}
+ conf_db = talloc_asprintf(test_ctx, "tests_conf.ldb");
+ if (conf_db == NULL) {
+ fail("Out of memory, aborting!");
+ talloc_free(test_ctx);
+ return ENOMEM;
+ }
+ DEBUG(3, ("CONFDB: %s\n", conf_db));
+
/* Connect to the conf db */
- ret = confdb_init(test_ctx, test_ctx->ev, &test_ctx->confdb);
+ ret = confdb_init(test_ctx, test_ctx->ev, &test_ctx->confdb, conf_db);
if(ret != EOK) {
fail("Could not initialize connection to the confdb");
talloc_free(test_ctx);
return ret;
}
- ret = sysdb_init(test_ctx, test_ctx->ev, test_ctx->confdb, &test_ctx->sysdb);
+ ret = sysdb_init(test_ctx, test_ctx->ev, test_ctx->confdb, "tests.ldb",
+ &test_ctx->sysdb);
if(ret != EOK) {
fail("Could not initialize connection to the sysdb");
talloc_free(test_ctx);