s4-torture: do some more inspection on expected witness_AsyncNotify replies.
authorGünther Deschner <gd@samba.org>
Wed, 1 Jul 2015 13:40:06 +0000 (15:40 +0200)
committerJosé A. Rivera <jarrpa@samba.org>
Tue, 14 Jul 2015 19:21:20 +0000 (21:21 +0200)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
source4/torture/rpc/witness.c

index 150ba7680b03119cc063cd235d9f271b02fb1192..9e56b18866bb8b4910d01934c83066398fbfe527 100644 (file)
@@ -702,6 +702,21 @@ static bool test_witness_AsyncNotify(struct torture_context *tctx,
                        dcerpc_witness_AsyncNotify_r_recv(req, tctx),
                        "failed to receive reply");
 
+               torture_assert_int_equal(tctx, response->num, 1, "num");
+               torture_assert_int_equal(tctx, response->type, WITNESS_NOTIFY_RESOURCE_CHANGE, "type");
+
+               /*
+                * TODO: find out how ClusterResourceOfflinePending and
+                * ClusterResourceOnlinePending are represented as witness
+                * types.
+                */
+
+               if (new_state == ClusterResourceOffline) {
+                       torture_assert_int_equal(tctx, response->messages[0].resource_change.type, WITNESS_RESOURCE_STATE_UNAVAILABLE, "resource_change.type");
+               }
+               if (new_state == ClusterResourceOnline) {
+                       torture_assert_int_equal(tctx, response->messages[0].resource_change.type, WITNESS_RESOURCE_STATE_AVAILABLE, "resource_change.type");
+               }
                torture_assert(tctx,
                        test_witness_UnRegister_with_handle(tctx, p, &state->context_handle),
                        "Failed to unregister");