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

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