summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2015-03-05 23:54:43 +0100
committerGünther Deschner <gd@samba.org>2015-03-13 23:58:09 +0100
commit5538e889a7f4fb788893d626a1f8e6a8c8440ae8 (patch)
treed167d1306dbe5cfe3ebfa46de1f823cf08cee00c /source4
parent07ba4c325a25990de328881fd58855ac9367ff1c (diff)
downloadsamba-5538e889a7f4fb788893d626a1f8e6a8c8440ae8.tar.gz
s4-torture: test all available nodes on the cluster.
Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/clusapi.c64
1 files changed, 64 insertions, 0 deletions
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);