root/lib/common/tests/probes/pcmk_xe_is_probe_test.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. op_is_probe_test

   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/unittest_internal.h>
  13 
  14 static void
  15 op_is_probe_test(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  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 
  25     node = pcmk__xml_parse("<" PCMK__XE_LRM_RSC_OP " "
  26                                   PCMK__XA_OPERATION_KEY "=\"blah\" "
  27                                   PCMK_META_INTERVAL "=\"30s\"/>");
  28     assert_false(pcmk_xe_is_probe(node));
  29     free_xml(node);
  30 
  31     node = pcmk__xml_parse("<" PCMK__XE_LRM_RSC_OP " "
  32                                   PCMK_XA_OPERATION
  33                                       "=\"" PCMK_ACTION_MONITOR "\" "
  34                                   PCMK_META_INTERVAL "=\"30s\"/>");
  35     assert_false(pcmk_xe_is_probe(node));
  36     free_xml(node);
  37 
  38     node = pcmk__xml_parse("<" PCMK__XE_LRM_RSC_OP " "
  39                                   PCMK_XA_OPERATION
  40                                       "=\"" PCMK_ACTION_START "\" "
  41                                   PCMK_META_INTERVAL "=\"0\"/>");
  42     assert_false(pcmk_xe_is_probe(node));
  43     free_xml(node);
  44 
  45     node = pcmk__xml_parse("<" PCMK__XE_LRM_RSC_OP " "
  46                                   PCMK_XA_OPERATION
  47                                       "=\"" PCMK_ACTION_MONITOR "\" "
  48                                   PCMK_META_INTERVAL "=\"0\"/>");
  49     assert_true(pcmk_xe_is_probe(node));
  50     free_xml(node);
  51 }
  52 
  53 PCMK__UNIT_TEST(pcmk__xml_test_setup_group, pcmk__xml_test_teardown_group,
  54                 cmocka_unit_test(op_is_probe_test))

/* [previous][next][first][last][top][bottom][index][help] */