58 if (strcmp(rsc->
id,
"dummy") == 0) {
60 }
else if (strcmp(rsc->
id,
"exim-group") == 0) {
62 }
else if (strcmp(rsc->
id,
"httpd-bundle") == 0) {
64 }
else if (strcmp(rsc->
id,
"mysql-clone-group") == 0) {
65 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
68 if (strcmp(child->
id,
"mysql-group:0") == 0) {
70 }
else if (strcmp(child->
id,
"mysql-group:1") == 0) {
74 }
else if (strcmp(rsc->
id,
"promotable-clone") == 0) {
75 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
78 if (strcmp(child->
id,
"promotable-rsc:0") == 0) {
80 }
else if (strcmp(child->
id,
"promotable-rsc:1") == 0) {
91 teardown(
void **state) {
98 bad_args(
void **state) {
101 assert_false(pe_base_name_eq(NULL,
"dummy"));
102 assert_false(pe_base_name_eq(
dummy, NULL));
105 assert_false(pe_base_name_eq(
dummy,
"dummy"));
110 primitive_rsc(
void **state) {
111 assert_true(pe_base_name_eq(
dummy,
"dummy"));
112 assert_false(pe_base_name_eq(
dummy,
"DUMMY"));
113 assert_false(pe_base_name_eq(
dummy,
"dUmMy"));
114 assert_false(pe_base_name_eq(
dummy,
"dummy0"));
115 assert_false(pe_base_name_eq(
dummy,
"dummy:0"));
119 group_rsc(
void **state) {
120 assert_true(pe_base_name_eq(
exim_group,
"exim-group"));
121 assert_false(pe_base_name_eq(
exim_group,
"EXIM-GROUP"));
122 assert_false(pe_base_name_eq(
exim_group,
"exim-group0"));
123 assert_false(pe_base_name_eq(
exim_group,
"exim-group:0"));
124 assert_false(pe_base_name_eq(
exim_group,
"Public-IP"));
128 clone_rsc(
void **state) {
129 assert_true(pe_base_name_eq(
promotable_0,
"promotable-rsc"));
130 assert_true(pe_base_name_eq(
promotable_1,
"promotable-rsc"));
132 assert_false(pe_base_name_eq(
promotable_0,
"promotable-rsc:0"));
133 assert_false(pe_base_name_eq(
promotable_1,
"promotable-rsc:1"));
134 assert_false(pe_base_name_eq(
promotable_0,
"PROMOTABLE-RSC"));
135 assert_false(pe_base_name_eq(
promotable_1,
"PROMOTABLE-RSC"));
136 assert_false(pe_base_name_eq(
promotable_0,
"Promotable-rsc"));
137 assert_false(pe_base_name_eq(
promotable_1,
"Promotable-rsc"));
141 bundle_rsc(
void **state) {
142 assert_true(pe_base_name_eq(
httpd_bundle,
"httpd-bundle"));
143 assert_false(pe_base_name_eq(
httpd_bundle,
"HTTPD-BUNDLE"));
145 assert_false(pe_base_name_eq(
httpd_bundle,
"httpd-docker-0"));
148 int main(
int argc,
char **argv) {
149 const struct CMUnitTest tests[] = {
150 cmocka_unit_test(bad_args),
151 cmocka_unit_test(primitive_rsc),
152 cmocka_unit_test(group_rsc),
153 cmocka_unit_test(clone_rsc),
154 cmocka_unit_test(bundle_rsc),
157 cmocka_set_message_output(CM_OUTPUT_TAP);
158 return cmocka_run_group_tests(tests, setup, teardown);
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
void crm_xml_init(void)
Initialize the CRM XML subsystem.
#define pe_flag_no_counts
Don't count total, disabled and blocked resource instances.
xmlNode * filename2xml(const char *filename)
int main(int argc, char **argv)
pe_working_set_t * data_set
pe_resource_t * promotable_0
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
Wrappers for and extensions to libxml2.
Cluster status and scheduling.
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)
pe_resource_t * httpd_bundle
pe_resource_t * exim_group
Data types for cluster status.
pe_resource_t * mysql_group_1