13 #include <sys/types.h> 19 #include <corosync/cpg.h> 22 confchg_fn1(cpg_handle_t handle,
const struct cpg_name *group_name,
23 const struct cpg_address *member_list,
size_t member_list_entries,
24 const struct cpg_address *left_list,
size_t left_list_entries,
25 const struct cpg_address *joined_list,
size_t joined_list_entries)
31 confchg_fn2(cpg_handle_t handle,
const struct cpg_name *group_name,
32 const struct cpg_address *member_list,
size_t member_list_entries,
33 const struct cpg_address *left_list,
size_t left_list_entries,
34 const struct cpg_address *joined_list,
size_t joined_list_entries)
40 null_cluster(
void **state)
51 .cpg_confchg_fn = NULL,
56 assert_ptr_equal(cluster.cpg.cpg_confchg_fn, NULL);
58 cluster.cpg.cpg_confchg_fn = confchg_fn1;
60 assert_ptr_equal(cluster.cpg.cpg_confchg_fn, NULL);
64 previous_fn_null(
void **state)
68 .cpg_confchg_fn = NULL,
74 assert_ptr_equal(cluster.cpg.cpg_confchg_fn, confchg_fn1);
78 previous_fn_nonnull(
void **state)
82 .cpg_confchg_fn = confchg_fn2,
88 assert_ptr_equal(cluster.cpg.cpg_confchg_fn, confchg_fn1);
92 cmocka_unit_test(null_cluster),
93 cmocka_unit_test(null_fn),
94 cmocka_unit_test(previous_fn_null),
95 cmocka_unit_test(previous_fn_nonnull))
98 #endif // SUPPORT_COROSYNC #define PCMK__UNIT_TEST(group_setup, group_teardown,...)
int pcmk_cpg_set_confchg_fn(pcmk_cluster_t *cluster, cpg_confchg_fn_t fn)
Set the CPG config change callback function for a cluster object.