This source file includes following definitions.
- is_stonith_param
- is_stonith_action_param
- main
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <glib.h>
13
14 #include <crm/common/agents.h>
15
16 static void
17 is_stonith_param(void)
18 {
19 g_assert_false(pcmk_stonith_param(NULL));
20 g_assert_false(pcmk_stonith_param(""));
21 g_assert_false(pcmk_stonith_param("unrecognized"));
22 g_assert_false(pcmk_stonith_param("pcmk_unrecognized"));
23 g_assert_false(pcmk_stonith_param("x" PCMK_STONITH_ACTION_LIMIT));
24 g_assert_false(pcmk_stonith_param(PCMK_STONITH_ACTION_LIMIT "x"));
25
26 g_assert_true(pcmk_stonith_param(PCMK_STONITH_ACTION_LIMIT));
27 g_assert_true(pcmk_stonith_param(PCMK_STONITH_DELAY_BASE));
28 g_assert_true(pcmk_stonith_param(PCMK_STONITH_DELAY_MAX));
29 g_assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_ARGUMENT));
30 g_assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_CHECK));
31 g_assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_LIST));
32 g_assert_true(pcmk_stonith_param(PCMK_STONITH_HOST_MAP));
33 g_assert_true(pcmk_stonith_param(PCMK_STONITH_PROVIDES));
34 g_assert_true(pcmk_stonith_param(PCMK_STONITH_STONITH_TIMEOUT));
35 }
36
37 static void
38 is_stonith_action_param(void)
39 {
40
41
42
43 g_assert_false(pcmk_stonith_param("pcmk_on_unrecognized"));
44 g_assert_true(pcmk_stonith_param("pcmk_on_action"));
45 g_assert_true(pcmk_stonith_param("pcmk_on_timeout"));
46 g_assert_true(pcmk_stonith_param("pcmk_on_retries"));
47 }
48
49 int
50 main(int argc, char **argv)
51 {
52 g_test_init(&argc, &argv, NULL);
53
54 g_test_add_func("/common/utils/parse_op_key/is_stonith_param",
55 is_stonith_param);
56 g_test_add_func("/common/utils/parse_op_key/is_stonith_action_param",
57 is_stonith_action_param);
58 return g_test_run();
59 }