pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
crm_generate_ra_key_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 all_params_null(void **state) {
17  assert_null(crm_generate_ra_key(NULL, NULL, NULL));
18 }
19 
20 static void
21 some_params_null(void **state) {
22  char *retval;
23 
24  assert_null(crm_generate_ra_key("std", "prov", NULL));
25 
26  retval = crm_generate_ra_key("std", NULL, "ty");
27  assert_string_equal(retval, "std:ty");
28  free(retval);
29 
30  assert_null(crm_generate_ra_key(NULL, "prov", "ty"));
31  assert_null(crm_generate_ra_key("std", NULL, NULL));
32  assert_null(crm_generate_ra_key(NULL, "prov", NULL));
33  assert_null(crm_generate_ra_key(NULL, NULL, "ty"));
34 }
35 
36 static void
37 no_params_null(void **state) {
38  char *retval;
39 
40  retval = crm_generate_ra_key("std", "prov", "ty");
41  assert_string_equal(retval, "std:prov:ty");
42  free(retval);
43 }
44 
45 PCMK__UNIT_TEST(NULL, NULL,
46  cmocka_unit_test(all_params_null),
47  cmocka_unit_test(some_params_null),
48  cmocka_unit_test(no_params_null))
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))
char * crm_generate_ra_key(const char *standard, const char *provider, const char *type)
Definition: agents.c:92