pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmk__parse_health_strategy_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 
14 static void
15 valid(void **state) {
16  assert_int_equal(pcmk__parse_health_strategy(NULL),
18 
19  assert_int_equal(pcmk__parse_health_strategy("none"),
21 
22  assert_int_equal(pcmk__parse_health_strategy("NONE"),
24 
25  assert_int_equal(pcmk__parse_health_strategy("None"),
27 
28  assert_int_equal(pcmk__parse_health_strategy("nOnE"),
30 
31  assert_int_equal(pcmk__parse_health_strategy("migrate-on-red"),
33 
34  assert_int_equal(pcmk__parse_health_strategy("only-green"),
36 
37  assert_int_equal(pcmk__parse_health_strategy("progressive"),
39 
40  assert_int_equal(pcmk__parse_health_strategy("custom"),
42 }
43 
44 static void
45 invalid(void **state) {
46  assert_int_equal(pcmk__parse_health_strategy("foo"),
48  assert_int_equal(pcmk__parse_health_strategy("custom1"),
50  assert_int_equal(pcmk__parse_health_strategy("not-only-green-here"),
52 }
53 
54 PCMK__UNIT_TEST(NULL, NULL,
55  cmocka_unit_test(valid),
56  cmocka_unit_test(invalid))
enum pcmk__health_strategy pcmk__parse_health_strategy(const char *value)
Definition: health.c:41
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))