24 #define PE__VARIANT_BUNDLE 1 68 if (strcmp(rsc->
id,
"exim-group") == 0) {
70 }
else if (strcmp(rsc->
id,
"httpd-bundle") == 0) {
72 }
else if (strcmp(rsc->
id,
"inactive-clone") == 0) {
74 }
else if (strcmp(rsc->
id,
"inactive-group") == 0) {
76 }
else if (strcmp(rsc->
id,
"mysql-clone-group") == 0) {
78 }
else if (strcmp(rsc->
id,
"promotable-clone") == 0) {
87 teardown(
void **state) {
94 bad_args(
void **state) {
113 name = g_ascii_strup(rsc->
id, -1);
124 primitive_rsc(
void **state) {
131 if (strcmp(rsc->
id,
"dummy") == 0) {
137 assert_non_null(
dummy);
158 group_rsc(
void **state) {
180 inactive_group_rsc(
void **state) {
203 group_member_rsc(
void **state) {
210 if (strcmp(rsc->
id,
"Public-IP") == 0) {
216 assert_non_null(public_ip);
219 assert_ptr_equal(public_ip,
native_find_rsc(public_ip,
"Public-IP", NULL, 0));
237 inactive_group_member_rsc(
void **state) {
244 if (strcmp(rsc->
id,
"inactive-dummy-1") == 0) {
245 inactive_dummy_1 = rsc;
250 assert_non_null(inactive_dummy_1);
253 assert_ptr_equal(inactive_dummy_1,
native_find_rsc(inactive_dummy_1,
"inactive-dummy-1", NULL, 0));
271 clone_rsc(
void **state) {
297 inactive_clone_rsc(
void **state) {
317 clone_instance_rsc(
void **state) {
325 if (strcmp(rsc->
id,
"promotable-rsc:0") == 0) {
327 }
else if (strcmp(rsc->
id,
"promotable-rsc:1") == 0) {
394 renamed_rsc(
void **state) {
402 if (strcmp(rsc->
id,
"promotable-rsc:0") == 0) {
404 }
else if (strcmp(rsc->
id,
"promotable-rsc:1") == 0) {
418 bundle_rsc(
void **state) {
437 bundle_replica_rsc(
void **state) {
438 pe__bundle_variant_data_t *bundle_data = NULL;
439 pe__bundle_replica_t *replica_0 = NULL;
447 replica_0 = (pe__bundle_replica_t *) bundle_data->replicas->data;
449 ip_0 = replica_0->ip;
450 child_0 = replica_0->child;
451 container_0 = replica_0->container;
452 remote_0 = replica_0->remote;
454 assert_non_null(ip_0);
455 assert_non_null(child_0);
456 assert_non_null(container_0);
457 assert_non_null(remote_0);
460 assert_ptr_equal(ip_0,
native_find_rsc(ip_0,
"httpd-bundle-ip-192.168.122.131", NULL, 0));
461 assert_ptr_equal(child_0,
native_find_rsc(child_0,
"httpd:0", NULL, 0));
462 assert_ptr_equal(container_0,
native_find_rsc(container_0,
"httpd-bundle-docker-0", NULL, 0));
463 assert_ptr_equal(remote_0,
native_find_rsc(remote_0,
"httpd-bundle-0", NULL, 0));
520 clone_group_rsc(
void **rsc) {
546 clone_group_instance_rsc(
void **rsc) {
554 if (strcmp(rsc->
id,
"mysql-group:0") == 0) {
556 }
else if (strcmp(rsc->
id,
"mysql-group:1") == 0) {
623 clone_group_member_rsc(
void **state) {
630 if (strcmp(rsc->
id,
"mysql-group:0") == 0) {
631 for (GList *iter2 = rsc->
children; iter2 != NULL; iter2 = iter2->next) {
634 if (strcmp(child->
id,
"mysql-proxy:0") == 0) {
644 assert_non_null(mysql_proxy);
647 assert_ptr_equal(mysql_proxy,
native_find_rsc(mysql_proxy,
"mysql-proxy:0", NULL, 0));
664 int main(
int argc,
char **argv) {
669 const struct CMUnitTest tests[] = {
670 cmocka_unit_test(bad_args),
671 cmocka_unit_test(primitive_rsc),
672 cmocka_unit_test(group_rsc),
673 cmocka_unit_test(inactive_group_rsc),
674 cmocka_unit_test(group_member_rsc),
675 cmocka_unit_test(inactive_group_member_rsc),
676 cmocka_unit_test(clone_rsc),
677 cmocka_unit_test(inactive_clone_rsc),
678 cmocka_unit_test(clone_instance_rsc),
679 cmocka_unit_test(renamed_rsc),
680 cmocka_unit_test(bundle_rsc),
681 cmocka_unit_test(bundle_replica_rsc),
682 cmocka_unit_test(clone_group_rsc),
683 cmocka_unit_test(clone_group_instance_rsc),
684 cmocka_unit_test(clone_group_member_rsc),
687 cmocka_set_message_output(CM_OUTPUT_TAP);
688 return cmocka_run_group_tests(tests, setup, teardown);
pe_node_t * pe_find_node(GList *node_list, const char *uname)
pe_resource_t * inactive_clone
void pe_free_working_set(pe_working_set_t *data_set)
Free a working set.
pe_resource_t * promotable_1
pe_working_set_t * pe_new_working_set(void)
Create a new working set.
#define pe_flag_no_compat
match resource not running anywhere
void crm_xml_init(void)
Initialize the CRM XML subsystem.
pe_resource_t * httpd_bundle
#define pe_flag_no_counts
Don't count total, disabled and blocked resource instances.
pe_resource_t * exim_group
pe_resource_t * inactive_group
xmlNode * filename2xml(const char *filename)
pe_resource_t * promotable_0
match only clone instances
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
pe_working_set_t * data_set
Wrappers for and extensions to libxml2.
pe_node_t * httpd_bundle_0
pe_resource_t * mysql_clone_group
match base name of any clone instance
pe_resource_t * promotable_clone
match resource ID or LRM history ID
Cluster status and scheduling.
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
pe_resource_t * mysql_group_0
gboolean cluster_status(pe_working_set_t *data_set)
#define pe__set_working_set_flags(working_set, flags_to_set)
int main(int argc, char **argv)
Data types for cluster status.
pe_resource_t * mysql_group_1
match resource active on specified node
match base name of anonymous clone instances