25 .rsc_provider =
"heartbeat",
26 .rsc_agent =
"IPaddr2",
28 .op_interval_ms = 10000,
36 #define EXPR_ATTRIBUTE \ 37 "<" PCMK_XE_EXPRESSION " " PCMK_XA_ID "='e' " \ 38 PCMK_XA_ATTRIBUTE "='foo' " \ 39 PCMK_XA_OPERATION "='" PCMK_VALUE_EQ "' " \ 40 PCMK_XA_VALUE "='bar' />" 43 null_invalid(
void **state)
61 #define EXPR_INVALID "<not_an_expression " PCMK_XA_ID "='e' />" 64 invalid_expression(
void **state)
82 attribute_expression(
void **state)
97 #define EXPR_LOCATION \ 98 "<" PCMK_XE_EXPRESSION " " PCMK_XA_ID "='e' " \ 99 PCMK_XA_ATTRIBUTE "='" CRM_ATTR_UNAME "' " \ 100 PCMK_XA_OPERATION "='" PCMK_VALUE_EQ "' " \ 101 PCMK_XA_VALUE "='node1' />" 104 location_expression(
void **state)
120 "<" PCMK_XE_DATE_EXPRESSION " " PCMK_XA_ID "='e' " \ 121 PCMK_XA_OPERATION "='" PCMK_VALUE_IN_RANGE "' " \ 122 PCMK_XA_START "='2024-02-01 12:00:00' " \ 123 PCMK_XA_END "='2024-02-01 15:00:00' />" 126 date_expression(
void **state)
133 rule_input.
now = now;
137 rule_input.
now = NULL;
144 #define EXPR_RESOURCE \ 145 "<" PCMK_XE_RSC_EXPRESSION " " PCMK_XA_ID "='e' " \ 146 PCMK_XA_CLASS "='" PCMK_RESOURCE_CLASS_OCF "' " \ 147 PCMK_XA_TYPE "='IPaddr2' />" 150 resource_expression(
void **state)
160 "<" PCMK_XE_OP_EXPRESSION " " PCMK_XA_ID "='e' " \ 161 PCMK_XA_NAME "='" PCMK_ACTION_MONITOR "' " \ 162 PCMK_XA_INTERVAL "='10s' />" 165 op_expression(
void **state)
174 #define EXPR_SUBRULE \ 175 "<" PCMK_XE_RULE " " PCMK_XA_ID "='r' " \ 176 " <" PCMK_XE_OP_EXPRESSION " " PCMK_XA_ID "='e' " \ 177 PCMK_XA_NAME "='" PCMK_ACTION_MONITOR "' " \ 178 PCMK_XA_INTERVAL "='10s' /> />" 181 subrule(
void **state)
190 cmocka_unit_test(null_invalid),
191 cmocka_unit_test(invalid_expression),
192 cmocka_unit_test(attribute_expression),
193 cmocka_unit_test(location_expression),
194 cmocka_unit_test(date_expression),
195 cmocka_unit_test(resource_expression),
196 cmocka_unit_test(op_expression),
197 cmocka_unit_test(subrule))
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
struct crm_time_s crm_time_t
#define PCMK_ACTION_MONITOR
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
#define PCMK_RESOURCE_CLASS_OCF
int pcmk__xml_test_setup_group(void **state)
Wrappers for and extensions to libxml2.
void free_xml(xmlNode *child)
xmlNode * pcmk__xml_parse(const char *input)
int crm_time_compare(const crm_time_t *a, const crm_time_t *b)
int pcmk__evaluate_condition(xmlNode *expr, const pcmk_rule_input_t *rule_input, crm_time_t *next_change)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
crm_time_t * crm_time_new(const char *string)
void pcmk__insert_dup(GHashTable *table, const char *name, const char *value)
void crm_time_free(crm_time_t *dt)