From 224a0dfad69c2e056f19e2b4865d592f495fb944 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 13 Feb 2009 14:17:24 -0500 Subject: Always pass teh database path explicitly, so that test cases can use throw away databases Check version and init main db if empty --- server/tests/sysdb-tests.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c index bb222fae..a24ae181 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); -- cgit