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

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

DEFINITIONS

This source file includes following definitions.
  1. ocf_standard
  2. stonith_standard
  3. service_standard
  4. lsb_standard
  5. nagios_standard
  6. unknown_standard

   1 /*
   2  * Copyright 2022-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 #include <crm/common/agents.h>
  14 
  15 static void
  16 ocf_standard(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  17 {
  18     uint32_t expected = pcmk_ra_cap_provider | pcmk_ra_cap_params
  19                         | pcmk_ra_cap_unique | pcmk_ra_cap_promotable
  20                         | pcmk_ra_cap_cli_exec;
  21 
  22     assert_int_equal(pcmk_get_ra_caps("ocf"), expected);
  23     assert_int_equal(pcmk_get_ra_caps("OCF"), expected);
  24 }
  25 
  26 static void
  27 stonith_standard(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  28     uint32_t expected = pcmk_ra_cap_params | pcmk_ra_cap_unique |
  29                         pcmk_ra_cap_stdin | pcmk_ra_cap_fence_params;
  30 
  31     assert_int_equal(pcmk_get_ra_caps("stonith"), expected);
  32     assert_int_equal(pcmk_get_ra_caps("StOnItH"), expected);
  33 }
  34 
  35 static void
  36 service_standard(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  37     assert_int_equal(pcmk_get_ra_caps("systemd"), pcmk_ra_cap_status);
  38     assert_int_equal(pcmk_get_ra_caps("SYSTEMD"), pcmk_ra_cap_status);
  39     assert_int_equal(pcmk_get_ra_caps("service"), pcmk_ra_cap_status);
  40     assert_int_equal(pcmk_get_ra_caps("SeRvIcE"), pcmk_ra_cap_status);
  41     assert_int_equal(pcmk_get_ra_caps("upstart"), pcmk_ra_cap_status);
  42     assert_int_equal(pcmk_get_ra_caps("uPsTaRt"), pcmk_ra_cap_status);
  43 }
  44 
  45 static void
  46 lsb_standard(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  47 {
  48     uint32_t expected = pcmk_ra_cap_status | pcmk_ra_cap_cli_exec;
  49 
  50     assert_int_equal(pcmk_get_ra_caps("lsb"), expected);
  51     assert_int_equal(pcmk_get_ra_caps("LSB"), expected);
  52 }
  53 
  54 static void
  55 nagios_standard(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  56     assert_int_equal(pcmk_get_ra_caps("nagios"), pcmk_ra_cap_params);
  57     assert_int_equal(pcmk_get_ra_caps("NAGios"), pcmk_ra_cap_params);
  58 }
  59 
  60 static void
  61 unknown_standard(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  62     assert_int_equal(pcmk_get_ra_caps("blahblah"), pcmk_ra_cap_none);
  63     assert_int_equal(pcmk_get_ra_caps(""), pcmk_ra_cap_none);
  64     assert_int_equal(pcmk_get_ra_caps(NULL), pcmk_ra_cap_none);
  65 }
  66 
  67 PCMK__UNIT_TEST(NULL, NULL,
  68                 cmocka_unit_test(ocf_standard),
  69                 cmocka_unit_test(stonith_standard),
  70                 cmocka_unit_test(service_standard),
  71                 cmocka_unit_test(lsb_standard),
  72                 cmocka_unit_test(nagios_standard),
  73                 cmocka_unit_test(unknown_standard))

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