From 5538e889a7f4fb788893d626a1f8e6a8c8440ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Thu, 5 Mar 2015 23:54:43 +0100 Subject: s4-torture: test all available nodes on the cluster. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Signed-off-by: Günther Deschner Reviewed-by: Stefan Metzmacher --- source4/torture/rpc/clusapi.c | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'source4') diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c index e6bc00db5b8..ca998a7f498 100644 --- a/source4/torture/rpc/clusapi.c +++ b/source4/torture/rpc/clusapi.c @@ -1220,6 +1220,68 @@ static bool test_EvictNode(struct torture_context *tctx, return ret; } +static bool test_one_node(struct torture_context *tctx, + struct dcerpc_pipe *p, + const char *node_name) +{ + struct policy_handle hNode; + + torture_assert(tctx, + test_OpenNode_int(tctx, p, node_name, &hNode), + "failed to open node"); + test_CloseNode_int(tctx, p, &hNode); + + torture_assert(tctx, + test_OpenNodeEx_int(tctx, p, node_name, &hNode), + "failed to openex node"); + + torture_assert(tctx, + test_GetNodeId_int(tctx, p, &hNode), + "failed to query node id"); + torture_assert(tctx, + test_GetNodeState_int(tctx, p, &hNode), + "failed to query node id"); + + test_CloseNode_int(tctx, p, &hNode); + + return true; +} + +static bool test_all_nodes(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + struct dcerpc_binding_handle *b = p->binding_handle; + struct clusapi_CreateEnum r; + uint32_t dwType = CLUSTER_ENUM_NODE; + struct ENUM_LIST *ReturnEnum; + WERROR rpc_status; + int i; + + r.in.dwType = dwType; + r.out.ReturnEnum = &ReturnEnum; + r.out.rpc_status = &rpc_status; + + torture_assert_ntstatus_ok(tctx, + dcerpc_clusapi_CreateEnum_r(b, tctx, &r), + "CreateEnum failed"); + torture_assert_werr_ok(tctx, + r.out.result, + "CreateEnum failed"); + + for (i=0; i < ReturnEnum->EntryCount; i++) { + + struct ENUM_ENTRY e = ReturnEnum->Entry[i]; + + torture_assert_int_equal(tctx, e.Type, CLUSTER_ENUM_NODE, "type mismatch"); + + torture_assert(tctx, + test_one_node(tctx, p, e.Name), + "failed to test one node"); + } + + return true; +} + static bool test_OpenGroup_int(struct torture_context *tctx, struct dcerpc_pipe *p, const char *lpszGroupName, @@ -1580,6 +1642,8 @@ struct torture_suite *torture_rpc_clusapi(TALLOC_CTX *mem_ctx) test = torture_rpc_tcase_add_test(tcase, "EvictNode", test_EvictNode); test->dangerous = true; + torture_rpc_tcase_add_test(tcase, "all_nodes", + test_all_nodes); tcase = torture_suite_add_rpc_iface_tcase(suite, "group", &ndr_table_clusapi); -- cgit v1.2.1