pacemaker  3.0.0-d8340737c4
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 
12 #include <crm/common/probes.h>
14 
15 static void
16 op_is_probe_test(void **state)
17 {
18  xmlNode *node = NULL;
19 
20  assert_false(pcmk_xe_is_probe(NULL));
21 
22  node = pcmk__xml_parse("<" PCMK__XE_LRM_RSC_OP "/>");
23  assert_false(pcmk_xe_is_probe(node));
24  pcmk__xml_free(node);
25 
27  PCMK__XA_OPERATION_KEY "=\"blah\" "
28  PCMK_META_INTERVAL "=\"30s\"/>");
29  assert_false(pcmk_xe_is_probe(node));
30  pcmk__xml_free(node);
31 
34  "=\"" PCMK_ACTION_MONITOR "\" "
35  PCMK_META_INTERVAL "=\"30s\"/>");
36  assert_false(pcmk_xe_is_probe(node));
37  pcmk__xml_free(node);
38 
41  "=\"" PCMK_ACTION_START "\" "
42  PCMK_META_INTERVAL "=\"0\"/>");
43  assert_false(pcmk_xe_is_probe(node));
44  pcmk__xml_free(node);
45 
48  "=\"" PCMK_ACTION_MONITOR "\" "
49  PCMK_META_INTERVAL "=\"0\"/>");
50  assert_true(pcmk_xe_is_probe(node));
51  pcmk__xml_free(node);
52 }
53 
55  cmocka_unit_test(op_is_probe_test))
#define PCMK__XA_OPERATION_KEY
Scheduler API for probes.
#define PCMK_ACTION_MONITOR
Definition: actions.h:51
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
#define PCMK_XA_OPERATION
Definition: xml_names.h:349
void pcmk__xml_free(xmlNode *xml)
Definition: xml.c:789
bool pcmk_xe_is_probe(const xmlNode *xml_op)
Check whether an action history entry represents a probe.
Definition: probes.c:46
#define PCMK_ACTION_START
Definition: actions.h:63
int pcmk__xml_test_setup_group(void **state)
Definition: unittest.c:85
int pcmk__xml_test_teardown_group(void **state)
Definition: unittest.c:104
xmlNode * pcmk__xml_parse(const char *input)
Definition: xml_io.c:168
#define PCMK_META_INTERVAL
Definition: options.h:91
#define PCMK__XE_LRM_RSC_OP