pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmk_xe_is_probe_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2021 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 
13 
14 static void
15 op_is_probe_test(void **state)
16 {
17  xmlNode *node = NULL;
18 
19  assert_false(pcmk_xe_is_probe(NULL));
20 
21  node = string2xml("<lrm_rsc_op/>");
22  assert_false(pcmk_xe_is_probe(node));
23  free_xml(node);
24 
25  node = string2xml("<lrm_rsc_op operation_key=\"blah\" interval=\"30s\"/>");
26  assert_false(pcmk_xe_is_probe(node));
27  free_xml(node);
28 
29  node = string2xml("<lrm_rsc_op operation=\"monitor\" interval=\"30s\"/>");
30  assert_false(pcmk_xe_is_probe(node));
31  free_xml(node);
32 
33  node = string2xml("<lrm_rsc_op operation=\"start\" interval=\"0\"/>");
34  assert_false(pcmk_xe_is_probe(node));
35  free_xml(node);
36 
37  node = string2xml("<lrm_rsc_op operation=\"monitor\" interval=\"0\"/>");
38  assert_true(pcmk_xe_is_probe(node));
39  free_xml(node);
40 }
41 
42 PCMK__UNIT_TEST(NULL, NULL,
43  cmocka_unit_test(op_is_probe_test))
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
xmlNode * string2xml(const char *input)
Definition: xml.c:800
bool pcmk_xe_is_probe(const xmlNode *xml_op)
Definition: actions.c:507
void free_xml(xmlNode *child)
Definition: xml.c:783