17 static char *cib_path = NULL;
20 cib_not_connected(
void **state)
34 setup_test(
void **state)
38 if (cib_path == NULL) {
46 teardown_test(
void **state)
54 bad_input(
void **state)
72 find_rsc(
const char *rsc)
74 GString *xpath = g_string_sized_new(1024);
75 xmlNode *xml_search = NULL;
85 cib->
cmds->
query(cib, (
const char *) xpath->str, &xml_search,
88 g_string_free(xpath, TRUE);
94 incorrect_type(
void **state)
107 result = find_rsc(
"Fencing");
114 correct_type(
void **state)
123 result = find_rsc(
"Fencing");
130 unknown_resource(
void **state)
152 cmocka_unit_test(cib_not_connected),
153 cmocka_unit_test_setup_teardown(bad_input, setup_test, teardown_test),
154 cmocka_unit_test_setup_teardown(incorrect_type, setup_test, teardown_test),
155 cmocka_unit_test_setup_teardown(correct_type, setup_test, teardown_test),
156 cmocka_unit_test_setup_teardown(unknown_resource, setup_test, teardown_test))
cib_t * cib_new(void)
Create a new CIB connection object.
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
cib_api_operations_t * cmds
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
int pcmk__xml_test_setup_group(void **state)
Wrappers for and extensions to libxml2.
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
void free_xml(xmlNode *child)
int cib__clean_up_connection(cib_t **cib)
void pcmk__cib_test_cleanup(char *out_path)
const char * pcmk_cib_xpath_for(const char *element_name)
Get the relative XPath needed to find a specified CIB element name.
pcmk__action_result_t result
void pcmk__assert_validates(xmlNode *xml)
char * pcmk__cib_test_copy_cib(const char *in_file)
#define PCMK_XE_RESOURCES
int pcmk_resource_delete(xmlNodePtr *xml, const char *rsc_id, const char *rsc_type)
Remove a resource.