pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
pcmk_resource_id_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 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 <stdio.h> // NULL
13 
14 #include <crm/common/resources.h>
16 
17 static void
18 null_resource(void **state)
19 {
20  assert_null(pcmk_resource_id(NULL));
21 }
22 
23 static void
24 resource_with_id(void **state)
25 {
26  char rsc1_id[] = "rsc1";
28  .id = rsc1_id,
29  };
30 
31  assert_string_equal(pcmk_resource_id(&rsc1), "rsc1");
32 }
33 
34 PCMK__UNIT_TEST(NULL, NULL,
35  cmocka_unit_test(null_resource),
36  cmocka_unit_test(resource_with_id))
Scheduler API for resources.
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
pcmk_resource_t rsc1
const char * pcmk_resource_id(const pcmk_resource_t *rsc)
Definition: resources.c:27