}
+static void context_test (int sock)
+{
+ confdb_handle_t handle;
+ char response[100];
+ char *cmp;
+ int res;
+
+ snprintf (response, 100, "%s", OK_STR);
+
+ res = confdb_initialize (&handle, &valid_callbacks);
+ if (res != CS_OK) {
+ syslog (LOG_ERR, "Could not initialize confdb error %d\n", res);
+ goto send_response;
+ }
+
+ confdb_context_set (handle, response);
+ confdb_context_get (handle, (const void**)&cmp);
+ if (response != cmp) {
+ snprintf (response, 100, "%s", FAIL_STR);
+ }
+
+send_response:
+ send (sock, response, strlen (response) + 1, 0);
+ confdb_finalize (handle);
+}
static void do_command (int sock, char* func, char*args[], int num_args)
{
object_find_test (sock);
} else if (strcmp ("notification_test", func) == 0) {
notification_test (sock);
+ } else if (strcmp ("context_test", func) == 0) {
+ context_test (sock);
} else if (strcmp ("are_you_ok_dude", func) == 0) {
snprintf (response, 100, "%s", OK_STR);
send (sock, response, strlen (response) + 1, 0);
send_some_more_messages_normal ();
}
+
+static void context_test (int sock)
+{
+ char response[100];
+ char *cmp;
+
+ cpg_context_set (cpg_handle, response);
+ cpg_context_get (cpg_handle, &cmp);
+ if (response != cmp) {
+ snprintf (response, 100, "%s", FAIL_STR);
+ }
+ else {
+ snprintf (response, 100, "%s", OK_STR);
+ }
+ send (sock, response, strlen (response) + 1, 0);
+}
+
static void msg_blaster_zcb (int sock, char* num_to_send_str)
{
my_msgs_to_send = atoi (num_to_send_str);
cpg_local_get (cpg_handle, &local_nodeid);
snprintf (response, 100, "%u",local_nodeid);
send (sock, response, strlen (response) + 1, 0);
-
- } else if (strcmp ("cpg_finalize",func) == 0) {
+ } else if (strcmp ("cpg_finalize", func) == 0) {
cpg_finalize (cpg_handle);
poll_dispatch_delete (ta_poll_handle_get(), cpg_fd);
cpg_fd = -1;
- } else if (strcmp ("record_config_events",func) == 0) {
-
+ } else if (strcmp ("record_config_events", func) == 0) {
record_config_events ();
-
- } else if (strcmp ("record_messages",func) == 0) {
-
+ } else if (strcmp ("record_messages", func) == 0) {
record_messages ();
-
- } else if (strcmp ("read_config_event",func) == 0) {
-
+ } else if (strcmp ("read_config_event", func) == 0) {
read_config_event (sock);
-
- } else if (strcmp ("read_messages",func) == 0) {
-
+ } else if (strcmp ("read_messages", func) == 0) {
read_messages (sock, args[0]);
-
} else if (strcmp ("msg_blaster_zcb", func) == 0) {
-
msg_blaster_zcb (sock, args[0]);
-
- } else if (strcmp ("msg_blaster",func) == 0) {
-
+ } else if (strcmp ("msg_blaster", func) == 0) {
msg_blaster (sock, args[0]);
+ } else if (strcmp ("context_test", func) == 0) {
+ context_test (sock);
} else if (strcmp ("are_you_ok_dude", func) == 0) {
snprintf (response, 100, "%s", OK_STR);
send (sock, response, strlen (response) + 1, 0);
{
num_sync_processes++;
- log_printf (LOGSYS_LEVEL_INFO, "sync: process %d", num_sync_processes);
-
if (num_sync_processes > 3) {
return 0;
} else {
send (sock, response, strlen (response), 0);
}
+static void context_test (int sock)
+{
+ char response[100];
+ char *cmp;
+
+ snprintf (response, 100, "%s", OK_STR);
+
+ votequorum_context_set (vq_handle, response);
+ votequorum_context_get (vq_handle, (void**)&cmp);
+ if (response != cmp) {
+ snprintf (response, 100, "%s", FAIL_STR);
+ syslog (LOG_ERR, "votequorum context not the same");
+ }
+
+ quorum_context_set (q_handle, response);
+ quorum_context_get (q_handle, (const void**)&cmp);
+ if (response != cmp) {
+ snprintf (response, 100, "%s", FAIL_STR);
+ syslog (LOG_ERR, "quorum context not the same");
+ }
+ send (sock, response, strlen (response) + 1, 0);
+}
+
static void do_command (int sock, char* func, char*args[], int num_args)
{
char response[100];
getquorate (sock);
} else if (strcmp ("init", func) == 0) {
lib_init (sock);
+ } else if (strcmp ("context_test", func) == 0) {
+ context_test (sock);
} else if (strcmp ("are_you_ok_dude", func) == 0) {
snprintf (response, 100, "%s", OK_STR);
send (sock, response, strlen (response) + 1, 0);
else:
return msg
+ def context_test(self):
+ self.send (["context_test"])
+ return self.read ()
+
###################################################################
class ConfdbTestAgent(TestAgent):
self.CM.apply_default_config()
return CTSTest.teardown(self, node)
+###################################################################
+class CpgContextTest(CoroTest):
+ def __init__(self, cm):
+ CoroTest.__init__(self, cm)
+ self.name="CpgContextTest"
+
+ def __call__(self, node):
+ self.incr("calls")
+ res = self.CM.cpg_agent[node].context_test()
+ if 'OK' in res:
+ return self.success()
+ else:
+ return self.failure('context_test failed')
###################################################################
class CpgConfigChangeBase(CoroTest):
else:
return self.failure('set_get_test failed')
+###################################################################
+class ConfdbContextTest(CoroTest):
+ def __init__(self, cm):
+ CoroTest.__init__(self, cm)
+ self.name="ConfdbContextTest"
+
+ def __call__(self, node):
+ self.incr("calls")
+ res = self.CM.confdb_agent[node].context_test()
+ if 'OK' in res:
+ return self.success()
+ else:
+ return self.failure('context_test failed')
+
###################################################################
class ConfdbIncrementTest(CoroTest):
return self.success()
+###################################################################
+class VoteQuorumContextTest(CoroTest):
+
+ def __init__(self, cm):
+ CoroTest.__init__(self, cm)
+ self.name="VoteQuorumContextTest"
+ self.expected = len(self.CM.Env["nodes"])
+ self.config['quorum/provider'] = 'corosync_votequorum'
+ self.config['quorum/expected_votes'] = self.expected
+
+ def __call__(self, node):
+ self.incr("calls")
+ res = self.CM.votequorum_agent[node].context_test()
+ if 'OK' in res:
+ return self.success()
+ else:
+ return self.failure('context_test failed')
###################################################################
class GenSimulStart(CoroTest):
-###################################################################
'''Start all the nodes ~ simultaneously'''
+
def __init__(self, cm):
CoroTest.__init__(self,cm)
self.name="GenSimulStart"
###################################################################
class GenSimulStop(CoroTest):
-###################################################################
'''Stop all the nodes ~ simultaneously'''
+
def __init__(self, cm):
CoroTest.__init__(self,cm)
self.name="GenSimulStop"
AllTestClasses.append(ConfdbIncrementTest)
AllTestClasses.append(ConfdbObjectFindTest)
AllTestClasses.append(ConfdbNotificationTest)
+AllTestClasses.append(ConfdbContextTest)
+AllTestClasses.append(CpgContextTest)
+AllTestClasses.append(VoteQuorumContextTest)
AllTestClasses.append(SamTest1)
AllTestClasses.append(SamTest2)
AllTestClasses.append(SamTest3)