27 .rsc_provider =
"heartbeat",
28 .rsc_agent =
"IPaddr2",
39 assert_rsc_expression(
const char *xml_string,
int reference_rc)
53 #define EXPR_ALL_MATCH \ 54 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 55 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 56 PCMK_XA_PROVIDER "='heartbeat' " \ 57 PCMK_XA_TYPE "='IPaddr2' />" 60 null_invalid(
void **state)
70 assert_rsc_expression(NULL, EINVAL);
78 #define EXPR_ID_MISSING \ 79 "<" PCMK_XE_RSC_EXPRESSION " " \ 80 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 81 PCMK_XA_PROVIDER "='heartbeat' " \ 82 PCMK_XA_TYPE "='IPaddr2' />" 84 #define EXPR_ID_EMPTY \ 85 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='' " \ 86 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 87 PCMK_XA_PROVIDER "='heartbeat' " \ 88 PCMK_XA_TYPE "='IPaddr2' />" 91 id_missing(
void **state)
103 #define EXPR_FAIL_STANDARD \ 104 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 105 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_LSB "' />" 107 #define EXPR_EMPTY_STANDARD \ 108 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 109 PCMK_XA_CLASS "='' />" 112 fail_standard(
void **state)
123 #define EXPR_FAIL_PROVIDER \ 124 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 125 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 126 PCMK_XA_PROVIDER "='pacemaker' " \ 127 PCMK_XA_TYPE "='IPaddr2' />" 129 #define EXPR_EMPTY_PROVIDER \ 130 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 131 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 132 PCMK_XA_PROVIDER "='' " PCMK_XA_TYPE "='IPaddr2' />" 135 fail_provider(
void **state)
146 #define EXPR_FAIL_AGENT \ 147 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 148 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 149 PCMK_XA_PROVIDER "='heartbeat' " \ 150 PCMK_XA_TYPE "='IPaddr3' />" 152 #define EXPR_EMPTY_AGENT \ 153 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 154 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 155 PCMK_XA_PROVIDER "='heartbeat' " PCMK_XA_TYPE "='' />" 158 fail_agent(
void **state)
169 #define EXPR_NO_STANDARD_MATCHES \ 170 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 171 PCMK_XA_PROVIDER "='heartbeat' " \ 172 PCMK_XA_TYPE "='IPaddr2' />" 175 no_standard_matches(
void **state)
180 #define EXPR_NO_PROVIDER_MATCHES \ 181 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 182 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 183 PCMK_XA_TYPE "='IPaddr2' />" 186 no_provider_matches(
void **state)
191 #define EXPR_NO_AGENT_MATCHES \ 192 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 193 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 194 PCMK_XA_PROVIDER "='heartbeat' />" 197 no_agent_matches(
void **state)
202 #define EXPR_NO_CRITERIA_MATCHES \ 203 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' />" 206 no_criteria_matches(
void **state)
212 all_match(
void **state)
218 cmocka_unit_test(null_invalid),
219 cmocka_unit_test(id_missing),
220 cmocka_unit_test(fail_standard),
221 cmocka_unit_test(fail_provider),
222 cmocka_unit_test(fail_agent),
223 cmocka_unit_test(no_standard_matches),
224 cmocka_unit_test(no_provider_matches),
225 cmocka_unit_test(no_agent_matches),
226 cmocka_unit_test(no_criteria_matches),
227 cmocka_unit_test(all_match))
#define EXPR_NO_STANDARD_MATCHES
#define EXPR_FAIL_STANDARD
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
#define PCMK_RESOURCE_CLASS_OCF
#define EXPR_NO_PROVIDER_MATCHES
#define EXPR_NO_AGENT_MATCHES
#define EXPR_EMPTY_STANDARD
int pcmk__xml_test_setup_group(void **state)
Wrappers for and extensions to libxml2.
void free_xml(xmlNode *child)
int pcmk__xml_test_teardown_group(void **state)
xmlNode * pcmk__xml_parse(const char *input)
#define EXPR_EMPTY_PROVIDER
#define EXPR_NO_CRITERIA_MATCHES
#define EXPR_FAIL_PROVIDER
G_GNUC_INTERNAL int pcmk__evaluate_rsc_expression(const xmlNode *expr, const pcmk_rule_input_t *rule_input)