23 assert_true(
parse_op_key(
"Fencing_monitor_60000", &rsc, &ty, &ms));
24 assert_string_equal(rsc,
"Fencing");
25 assert_string_equal(ty,
"monitor");
26 assert_int_equal(ms, 60000);
31 assert_true(
parse_op_key(
"R_monitor_100000", &rsc, &ty, &ms));
32 assert_string_equal(rsc,
"R");
33 assert_string_equal(ty,
"monitor");
34 assert_int_equal(ms, 100000);
40 assert_string_equal(rsc,
"R");
41 assert_string_equal(ty,
"A");
42 assert_int_equal(ms, 0);
48 rsc_just_underbars(
void **state)
54 assert_true(
parse_op_key(
"__monitor_1000", &rsc, &ty, &ms));
55 assert_string_equal(rsc,
"_");
56 assert_string_equal(ty,
"monitor");
57 assert_int_equal(ms, 1000);
61 assert_true(
parse_op_key(
"___migrate_from_0", &rsc, &ty, &ms));
62 assert_string_equal(rsc,
"__");
63 assert_string_equal(ty,
"migrate_from");
64 assert_int_equal(ms, 0);
68 assert_true(
parse_op_key(
"____pre_notify_stop_0", &rsc, &ty, &ms));
69 assert_string_equal(rsc,
"___");
70 assert_string_equal(ty,
"pre_notify_stop");
71 assert_int_equal(ms, 0);
77 colon_in_rsc(
void **state)
83 assert_true(
parse_op_key(
"ClusterIP:0_start_0", &rsc, &ty, &ms));
84 assert_string_equal(rsc,
"ClusterIP:0");
85 assert_string_equal(ty,
"start");
86 assert_int_equal(ms, 0);
90 assert_true(
parse_op_key(
"imagestoreclone:1_post_notify_stop_0", &rsc, &ty, &ms));
91 assert_string_equal(rsc,
"imagestoreclone:1");
92 assert_string_equal(ty,
"post_notify_stop");
93 assert_int_equal(ms, 0);
99 dashes_in_rsc(
void **state)
105 assert_true(
parse_op_key(
"httpd-bundle-0_monitor_30000", &rsc, &ty, &ms));
106 assert_string_equal(rsc,
"httpd-bundle-0");
107 assert_string_equal(ty,
"monitor");
108 assert_int_equal(ms, 30000);
112 assert_true(
parse_op_key(
"httpd-bundle-ip-192.168.122.132_start_0", &rsc, &ty, &ms));
113 assert_string_equal(rsc,
"httpd-bundle-ip-192.168.122.132");
114 assert_string_equal(ty,
"start");
115 assert_int_equal(ms, 0);
121 migrate_to_from(
void **state)
127 assert_true(
parse_op_key(
"vm_migrate_from_0", &rsc, &ty, &ms));
128 assert_string_equal(rsc,
"vm");
129 assert_string_equal(ty,
"migrate_from");
130 assert_int_equal(ms, 0);
134 assert_true(
parse_op_key(
"vm_migrate_to_0", &rsc, &ty, &ms));
135 assert_string_equal(rsc,
"vm");
136 assert_string_equal(ty,
"migrate_to");
137 assert_int_equal(ms, 0);
141 assert_true(
parse_op_key(
"vm_idcc_devel_migrate_to_0", &rsc, &ty, &ms));
142 assert_string_equal(rsc,
"vm_idcc_devel");
143 assert_string_equal(ty,
"migrate_to");
144 assert_int_equal(ms, 0);
150 pre_post(
void **state)
156 assert_true(
parse_op_key(
"rsc_drbd_7788:1_post_notify_start_0", &rsc, &ty, &ms));
157 assert_string_equal(rsc,
"rsc_drbd_7788:1");
158 assert_string_equal(ty,
"post_notify_start");
159 assert_int_equal(ms, 0);
163 assert_true(
parse_op_key(
"rabbitmq-bundle-clone_pre_notify_stop_0", &rsc, &ty, &ms));
164 assert_string_equal(rsc,
"rabbitmq-bundle-clone");
165 assert_string_equal(ty,
"pre_notify_stop");
166 assert_int_equal(ms, 0);
170 assert_true(
parse_op_key(
"post_notify_start_0", &rsc, &ty, &ms));
171 assert_string_equal(rsc,
"post_notify");
172 assert_string_equal(ty,
"start");
173 assert_int_equal(ms, 0);
177 assert_true(
parse_op_key(
"r_confirmed-post_notify_start_0",
179 assert_string_equal(rsc,
"r");
180 assert_string_equal(ty,
"confirmed-post_notify_start");
181 assert_int_equal(ms, 0);
187 skip_rsc(
void **state)
192 assert_true(
parse_op_key(
"Fencing_monitor_60000", NULL, &ty, &ms));
193 assert_string_equal(ty,
"monitor");
194 assert_int_equal(ms, 60000);
199 skip_ty(
void **state)
204 assert_true(
parse_op_key(
"Fencing_monitor_60000", &rsc, NULL, &ms));
205 assert_string_equal(rsc,
"Fencing");
206 assert_int_equal(ms, 60000);
211 skip_ms(
void **state)
216 assert_true(
parse_op_key(
"Fencing_monitor_60000", &rsc, &ty, NULL));
217 assert_string_equal(rsc,
"Fencing");
218 assert_string_equal(ty,
"monitor");
224 empty_input(
void **state)
233 assert_int_equal(ms, 0);
238 assert_int_equal(ms, 0);
242 malformed_input(
void **state)
248 assert_false(
parse_op_key(
"httpd-bundle-0", &rsc, &ty, &ms));
251 assert_int_equal(ms, 0);
253 assert_false(
parse_op_key(
"httpd-bundle-0_monitor", &rsc, &ty, &ms));
256 assert_int_equal(ms, 0);
258 assert_false(
parse_op_key(
"httpd-bundle-0_30000", &rsc, &ty, &ms));
261 assert_int_equal(ms, 0);
265 cmocka_unit_test(basic),
266 cmocka_unit_test(rsc_just_underbars),
267 cmocka_unit_test(colon_in_rsc),
268 cmocka_unit_test(dashes_in_rsc),
269 cmocka_unit_test(migrate_to_from),
270 cmocka_unit_test(pre_post),
271 cmocka_unit_test(skip_rsc),
272 cmocka_unit_test(skip_ty),
273 cmocka_unit_test(skip_ms),
274 cmocka_unit_test(empty_input),
275 cmocka_unit_test(malformed_input))
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)