pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
pcmk_xe_is_probe_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2021-2024 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 = pcmk__xml_parse("<" PCMK__XE_LRM_RSC_OP "/>");
22  assert_false(pcmk_xe_is_probe(node));
23  free_xml(node);
24 
26  PCMK__XA_OPERATION_KEY "=\"blah\" "
27  PCMK_META_INTERVAL "=\"30s\"/>");
28  assert_false(pcmk_xe_is_probe(node));
29  free_xml(node);
30 
33  "=\"" PCMK_ACTION_MONITOR "\" "
34  PCMK_META_INTERVAL "=\"30s\"/>");
35  assert_false(pcmk_xe_is_probe(node));
36  free_xml(node);
37 
40  "=\"" PCMK_ACTION_START "\" "
41  PCMK_META_INTERVAL "=\"0\"/>");
42  assert_false(pcmk_xe_is_probe(node));
43  free_xml(node);
44 
47  "=\"" PCMK_ACTION_MONITOR "\" "
48  PCMK_META_INTERVAL "=\"0\"/>");
49  assert_true(pcmk_xe_is_probe(node));
50  free_xml(node);
51 }
52 
54  cmocka_unit_test(op_is_probe_test))
#define PCMK__XA_OPERATION_KEY
#define PCMK_ACTION_MONITOR
Definition: actions.h:60
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
#define PCMK_XA_OPERATION
Definition: xml_names.h:349
bool pcmk_xe_is_probe(const xmlNode *xml_op)
Check whether an action history entry represents a probe.
Definition: probes.c:45
#define PCMK_ACTION_START
Definition: actions.h:72
int pcmk__xml_test_setup_group(void **state)
Definition: unittest.c:85
void free_xml(xmlNode *child)
Definition: xml.c:958
int pcmk__xml_test_teardown_group(void **state)
Definition: unittest.c:104
xmlNode * pcmk__xml_parse(const char *input)
Definition: xml_io.c:245
#define PCMK_META_INTERVAL
Definition: options.h:91
#define PCMK__XE_LRM_RSC_OP