From c328ade5cd1833913beb4c288143bf63814c1393 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Thu, 26 Mar 2015 13:12:35 +0100 Subject: [PATCH] s4-torture: using async dcerpc for witness async notifications. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This test toggles the online/offline resource state using the clusapi protocol between the send and receive. Guenther Signed-off-by: Günther Deschner Reviewed-by: Stefan Metzmacher --- source4/torture/rpc/witness.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/source4/torture/rpc/witness.c b/source4/torture/rpc/witness.c index 78f3702ebf5..f040e0b9ea4 100644 --- a/source4/torture/rpc/witness.c +++ b/source4/torture/rpc/witness.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/ndr_srvsvc_c.h" #include "librpc/gen_ndr/ndr_clusapi_c.h" #include "param/param.h" +#include struct torture_test_clusapi_state { struct dcerpc_pipe *p; @@ -623,10 +624,6 @@ static bool toggle_cluster_resource_state(struct torture_context *tctx, return true; } -/* for this test to run, we need to have some basic clusapi client support - * first, so that we can programmatically change something in the cluster and - * then receive async notifications - Guenther */ - static bool test_witness_AsyncNotify(struct torture_context *tctx, struct dcerpc_pipe *p, void *data) @@ -638,8 +635,6 @@ static bool test_witness_AsyncNotify(struct torture_context *tctx, (struct torture_test_witness_state *)data; int i; - torture_skip(tctx, "skipping witness_AsyncNotify test"); - init_witness_test_state(tctx, p, state); setup_clusapi_connection(tctx, state); @@ -649,6 +644,7 @@ static bool test_witness_AsyncNotify(struct torture_context *tctx, const char *ip_address; struct witness_interfaceInfo interface = state->list->interfaces[i]; struct witness_Register reg; + struct tevent_req *req; if (!check_valid_interface(tctx, &interface)) { continue; @@ -675,9 +671,20 @@ static bool test_witness_AsyncNotify(struct torture_context *tctx, r.in.context_handle = state->context_handle; r.out.response = &response; + req = dcerpc_witness_AsyncNotify_r_send(tctx, tctx->ev, b, &r); + torture_assert(tctx, req, "failed to create request"); + + torture_assert(tctx, + toggle_cluster_resource_state(tctx, state->clusapi.p, state->net_name), + "failed to toggle cluster resource state"); + + torture_assert(tctx, + tevent_req_poll(req, tctx->ev), + "failed to call event loop"); + torture_assert_ntstatus_ok(tctx, - dcerpc_witness_AsyncNotify_r(b, tctx, &r), - "AsyncNotify failed"); + dcerpc_witness_AsyncNotify_r_recv(req, tctx), + "failed to receive reply"); torture_assert(tctx, test_witness_UnRegister_with_handle(tctx, p, &state->context_handle), -- 2.11.4.GIT