22 g_assert_true(
parse_op_key(
"Fencing_monitor_60000", &rsc, &ty, &ms));
23 g_assert_cmpstr(rsc, ==,
"Fencing");
24 g_assert_cmpstr(ty, ==,
"monitor");
25 g_assert_cmpint(ms, ==, 60000);
37 g_assert_true(
parse_op_key(
"ClusterIP:0_start_0", &rsc, &ty, &ms));
38 g_assert_cmpstr(rsc, ==,
"ClusterIP:0");
39 g_assert_cmpstr(ty, ==,
"start");
40 g_assert_cmpint(ms, ==, 0);
44 g_assert_true(
parse_op_key(
"imagestoreclone:1_post_notify_stop_0", &rsc, &ty, &ms));
45 g_assert_cmpstr(rsc, ==,
"imagestoreclone:1");
46 g_assert_cmpstr(ty, ==,
"post_notify_stop");
47 g_assert_cmpint(ms, ==, 0);
59 g_assert_true(
parse_op_key(
"httpd-bundle-0_monitor_30000", &rsc, &ty, &ms));
60 g_assert_cmpstr(rsc, ==,
"httpd-bundle-0");
61 g_assert_cmpstr(ty, ==,
"monitor");
62 g_assert_cmpint(ms, ==, 30000);
66 g_assert_true(
parse_op_key(
"httpd-bundle-ip-192.168.122.132_start_0", &rsc, &ty, &ms));
67 g_assert_cmpstr(rsc, ==,
"httpd-bundle-ip-192.168.122.132");
68 g_assert_cmpstr(ty, ==,
"start");
69 g_assert_cmpint(ms, ==, 0);
81 g_assert_true(
parse_op_key(
"vm_migrate_from_0", &rsc, &ty, &ms));
82 g_assert_cmpstr(rsc, ==,
"vm");
83 g_assert_cmpstr(ty, ==,
"migrate_from");
84 g_assert_cmpint(ms, ==, 0);
88 g_assert_true(
parse_op_key(
"vm_migrate_to_0", &rsc, &ty, &ms));
89 g_assert_cmpstr(rsc, ==,
"vm");
90 g_assert_cmpstr(ty, ==,
"migrate_to");
91 g_assert_cmpint(ms, ==, 0);
95 g_assert_true(
parse_op_key(
"vm_idcc_devel_migrate_to_0", &rsc, &ty, &ms));
96 g_assert_cmpstr(rsc, ==,
"vm_idcc_devel");
97 g_assert_cmpstr(ty, ==,
"migrate_to");
98 g_assert_cmpint(ms, ==, 0);
110 g_assert_true(
parse_op_key(
"rsc_drbd_7788:1_post_notify_start_0", &rsc, &ty, &ms));
111 g_assert_cmpstr(rsc, ==,
"rsc_drbd_7788:1");
112 g_assert_cmpstr(ty, ==,
"post_notify_start");
113 g_assert_cmpint(ms, ==, 0);
117 g_assert_true(
parse_op_key(
"rabbitmq-bundle-clone_pre_notify_stop_0", &rsc, &ty, &ms));
118 g_assert_cmpstr(rsc, ==,
"rabbitmq-bundle-clone");
119 g_assert_cmpstr(ty, ==,
"pre_notify_stop");
120 g_assert_cmpint(ms, ==, 0);
124 g_assert_true(
parse_op_key(
"post_notify_start_0", &rsc, &ty, &ms));
125 g_assert_cmpstr(rsc, ==,
"post_notify");
126 g_assert_cmpstr(ty, ==,
"start");
127 g_assert_cmpint(ms, ==, 0);
138 g_assert_true(
parse_op_key(
"Fencing_monitor_60000", NULL, &ty, &ms));
139 g_assert_cmpstr(ty, ==,
"monitor");
140 g_assert_cmpint(ms, ==, 60000);
150 g_assert_true(
parse_op_key(
"Fencing_monitor_60000", &rsc, NULL, &ms));
151 g_assert_cmpstr(rsc, ==,
"Fencing");
152 g_assert_cmpint(ms, ==, 60000);
162 g_assert_true(
parse_op_key(
"Fencing_monitor_60000", &rsc, &ty, NULL));
163 g_assert_cmpstr(rsc, ==,
"Fencing");
164 g_assert_cmpstr(ty, ==,
"monitor");
179 g_assert_cmpint(ms, ==, 0);
184 g_assert_cmpint(ms, ==, 0);
188 malformed_input(
void)
194 g_assert_false(
parse_op_key(
"httpd-bundle-0", &rsc, &ty, &ms));
197 g_assert_cmpint(ms, ==, 0);
199 g_assert_false(
parse_op_key(
"httpd-bundle-0_monitor", &rsc, &ty, &ms));
202 g_assert_cmpint(ms, ==, 0);
204 g_assert_false(
parse_op_key(
"httpd-bundle-0_30000", &rsc, &ty, &ms));
207 g_assert_cmpint(ms, ==, 0);
210 int main(
int argc,
char **argv)
212 g_test_init(&argc, &argv, NULL);
214 g_test_add_func(
"/common/utils/parse_op_key/basic", basic);
215 g_test_add_func(
"/common/utils/parse_op_key/colon_in_rsc", colon_in_rsc);
216 g_test_add_func(
"/common/utils/parse_op_key/dashes_in_rsc", dashes_in_rsc);
217 g_test_add_func(
"/common/utils/parse_op_key/migrate_to_from", migrate_to_from);
218 g_test_add_func(
"/common/utils/parse_op_key/pre_post", pre_post);
220 g_test_add_func(
"/common/utils/parse_op_key/skip_rsc", skip_rsc);
221 g_test_add_func(
"/common/utils/parse_op_key/skip_ty", skip_ty);
222 g_test_add_func(
"/common/utils/parse_op_key/skip_ms", skip_ms);
224 g_test_add_func(
"/common/utils/parse_op_key/empty_input", empty_input);
225 g_test_add_func(
"/common/utils/parse_op_key/malformed_input", malformed_input);
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
int main(int argc, char **argv)