pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmk_get_ra_caps_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2022 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 
13 #include <crm/common/agents.h>
14 
15 static void
16 ocf_standard(void **state) {
17  uint32_t expected = pcmk_ra_cap_provider | pcmk_ra_cap_params |
19 
20  assert_int_equal(pcmk_get_ra_caps("ocf"), expected);
21  assert_int_equal(pcmk_get_ra_caps("OCF"), expected);
22 }
23 
24 static void
25 stonith_standard(void **state) {
26  uint32_t expected = pcmk_ra_cap_params | pcmk_ra_cap_unique |
28 
29  assert_int_equal(pcmk_get_ra_caps("stonith"), expected);
30  assert_int_equal(pcmk_get_ra_caps("StOnItH"), expected);
31 }
32 
33 static void
34 service_standard(void **state) {
35  assert_int_equal(pcmk_get_ra_caps("systemd"), pcmk_ra_cap_status);
36  assert_int_equal(pcmk_get_ra_caps("SYSTEMD"), pcmk_ra_cap_status);
37  assert_int_equal(pcmk_get_ra_caps("service"), pcmk_ra_cap_status);
38  assert_int_equal(pcmk_get_ra_caps("SeRvIcE"), pcmk_ra_cap_status);
39  assert_int_equal(pcmk_get_ra_caps("lsb"), pcmk_ra_cap_status);
40  assert_int_equal(pcmk_get_ra_caps("LSB"), 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 nagios_standard(void **state) {
47  assert_int_equal(pcmk_get_ra_caps("nagios"), pcmk_ra_cap_params);
48  assert_int_equal(pcmk_get_ra_caps("NAGios"), pcmk_ra_cap_params);
49 }
50 
51 static void
52 unknown_standard(void **state) {
53  assert_int_equal(pcmk_get_ra_caps("blahblah"), pcmk_ra_cap_none);
54  assert_int_equal(pcmk_get_ra_caps(""), pcmk_ra_cap_none);
55  assert_int_equal(pcmk_get_ra_caps(NULL), pcmk_ra_cap_none);
56 }
57 
58 PCMK__UNIT_TEST(NULL, NULL,
59  cmocka_unit_test(ocf_standard),
60  cmocka_unit_test(stonith_standard),
61  cmocka_unit_test(service_standard),
62  cmocka_unit_test(nagios_standard),
63  cmocka_unit_test(unknown_standard))
API related to resource agents.
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
uint32_t pcmk_get_ra_caps(const char *standard)
Get capabilities of a resource agent standard.
Definition: agents.c:31