1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

s4/drs(tort): Convert DSSYNC test to a test case fixture

Now it should be much more clear why and where a test
in DSSYNC test case has failed.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Kamen Mazdrashki 2009-11-16 03:28:01 +02:00 committed by Andrew Bartlett
parent 442cded430
commit b9e262c512
2 changed files with 68 additions and 24 deletions

View File

@ -1016,30 +1016,74 @@ static bool test_FetchNT4Data(struct torture_context *tctx,
return true;
}
bool torture_rpc_dssync(struct torture_context *torture)
/**
* DSSYNC test case setup
*/
static bool torture_dssync_tcase_setup(struct torture_context *tctx, void **data)
{
bool ret = true;
TALLOC_CTX *mem_ctx;
bool bret;
struct DsSyncTest *ctx;
mem_ctx = talloc_init("torture_rpc_dssync");
ctx = test_create_context(torture);
ret &= _test_DsBind(torture, ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
if (!ret) {
return ret;
}
ret &= test_LDAPBind(torture, ctx, ctx->admin.credentials, &ctx->admin.ldap);
if (!ret) {
return ret;
}
ret &= test_GetInfo(torture, ctx);
ret &= _test_DsBind(torture, ctx, ctx->new_dc.credentials, &ctx->new_dc.drsuapi);
if (!ret) {
return ret;
}
ret &= test_FetchData(torture, ctx);
ret &= test_FetchNT4Data(torture, ctx);
return ret;
*data = ctx = test_create_context(tctx);
torture_assert(tctx, ctx, "test_create_context() failed");
bret = _test_DsBind(tctx, ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
torture_assert(tctx, bret, "_test_DsBind() failed");
bret = test_LDAPBind(tctx, ctx, ctx->admin.credentials, &ctx->admin.ldap);
torture_assert(tctx, bret, "test_LDAPBind() failed");
bret = test_GetInfo(tctx, ctx);
torture_assert(tctx, bret, "test_GetInfo() failed");
bret = _test_DsBind(tctx, ctx, ctx->new_dc.credentials, &ctx->new_dc.drsuapi);
torture_assert(tctx, bret, "_test_DsBind() failed");
return true;
}
/**
* DSSYNC test case cleanup
*/
static bool torture_dssync_tcase_teardown(struct torture_context *tctx, void *data)
{
struct DsSyncTest *ctx;
struct drsuapi_DsUnbind r;
struct policy_handle bind_handle;
ctx = talloc_get_type(data, struct DsSyncTest);
ZERO_STRUCT(r);
r.out.bind_handle = &bind_handle;
/* Unbing admin handle */
r.in.bind_handle = &ctx->admin.drsuapi.bind_handle;
dcerpc_drsuapi_DsUnbind(ctx->admin.drsuapi.drs_pipe, ctx, &r);
/* Unbing new_dc handle */
r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle;
dcerpc_drsuapi_DsUnbind(ctx->new_dc.drsuapi.drs_pipe, ctx, &r);
talloc_free(ctx);
return true;
}
/**
* DSSYNC test case implementation
*/
void torture_drs_rpc_dssync_tcase(struct torture_suite *suite)
{
typedef bool (*run_func) (struct torture_context *test, void *tcase_data);
struct torture_test *test;
struct torture_tcase *tcase = torture_suite_add_tcase(suite, "DSSYNC");
torture_tcase_set_fixture(tcase,
torture_dssync_tcase_setup,
torture_dssync_tcase_teardown);
test = torture_tcase_add_simple_test(tcase, "DC_FetchData", (run_func)test_FetchData);
test = torture_tcase_add_simple_test(tcase, "FetchNT4Data", (run_func)test_FetchNT4Data);
}

View File

@ -495,7 +495,7 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_simple_test(suite, "SAMBA3-REGCONFIG", torture_samba3_regconfig);
torture_suite_add_simple_test(suite, "ALTERCONTEXT", torture_rpc_alter_context);
torture_suite_add_simple_test(suite, "JOIN", torture_rpc_join);
torture_suite_add_simple_test(suite, "DSSYNC", torture_rpc_dssync);
torture_drs_rpc_dssync_tcase(suite);
torture_suite_add_simple_test(suite, "BENCH-RPC", torture_bench_rpc);
torture_suite_add_simple_test(suite, "ASYNCBIND", torture_async_bind);
torture_suite_add_suite(suite, torture_rpc_ntsvcs(suite));