root/lib/common/tests/agents/pcmk_stonith_param_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. is_stonith_param
  2. is_stonith_action_param

   1 /*
   2  * Copyright 2020-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 Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #include <crm_internal.h>
  11 
  12 #include <crm/common/unittest_internal.h>
  13 #include <crm/common/agents.h>
  14 
  15 static void
  16 is_stonith_param(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  17 {
  18     assert_false(pcmk_stonith_param(NULL));
  19     assert_false(pcmk_stonith_param(""));
  20     assert_false(pcmk_stonith_param("unrecognized"));
  21     assert_false(pcmk_stonith_param("pcmk_unrecognized"));
  22     assert_false(pcmk_stonith_param("x" PCMK_STONITH_ACTION_LIMIT));
  23     assert_false(pcmk_stonith_param(PCMK_STONITH_ACTION_LIMIT "x"));
  24 
  25     assert_true(pcmk_stonith_param(PCMK_STONITH_ACTION_LIMIT));
  26     assert_true(pcmk_stonith_param(PCMK_STONITH_DELAY_BASE));
  27     assert_true(pcmk_stonith_param(PCMK_STONITH_DELAY_MAX));
  28     assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_ARGUMENT));
  29     assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_CHECK));
  30     assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_LIST));
  31     assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_MAP));
  32     assert_true(pcmk_stonith_param(PCMK_STONITH_PROVIDES));
  33     assert_true(pcmk_stonith_param(PCMK_STONITH_STONITH_TIMEOUT));
  34 }
  35 
  36 static void
  37 is_stonith_action_param(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39     /* Currently, the function accepts any string not containing underbars as
  40      * the action name, so we do not need to verify particular action names.
  41      */
  42     assert_false(pcmk_stonith_param("pcmk_on_unrecognized"));
  43     assert_true(pcmk_stonith_param("pcmk_on_action"));
  44     assert_true(pcmk_stonith_param("pcmk_on_timeout"));
  45     assert_true(pcmk_stonith_param("pcmk_on_retries"));
  46 }
  47 
  48 PCMK__UNIT_TEST(NULL, NULL,
  49                 cmocka_unit_test(is_stonith_param),
  50                 cmocka_unit_test(is_stonith_action_param))

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