diff options
Diffstat (limited to '')
-rw-r--r-- | lib/pengine/tests/Makefile.am | 15 | ||||
-rw-r--r-- | lib/pengine/tests/native/Makefile.am | 4 | ||||
-rw-r--r-- | lib/pengine/tests/native/native_find_rsc_test.c | 724 | ||||
-rw-r--r-- | lib/pengine/tests/native/pe_base_name_eq_test.c | 31 | ||||
-rw-r--r-- | lib/pengine/tests/status/Makefile.am | 12 | ||||
-rw-r--r-- | lib/pengine/tests/status/pe_find_node_any_test.c | 6 | ||||
-rw-r--r-- | lib/pengine/tests/status/pe_find_node_id_test.c | 6 | ||||
-rw-r--r-- | lib/pengine/tests/status/pe_find_node_test.c | 6 | ||||
-rw-r--r-- | lib/pengine/tests/status/pe_new_working_set_test.c | 10 | ||||
-rw-r--r-- | lib/pengine/tests/status/set_working_set_defaults_test.c | 27 | ||||
-rw-r--r-- | lib/pengine/tests/utils/Makefile.am | 5 | ||||
-rw-r--r-- | lib/pengine/tests/utils/pe__cmp_node_name_test.c | 6 | ||||
-rw-r--r-- | lib/pengine/tests/utils/pe__cmp_rsc_priority_test.c | 4 |
13 files changed, 556 insertions, 300 deletions
diff --git a/lib/pengine/tests/Makefile.am b/lib/pengine/tests/Makefile.am index 4986ef2..48ec5b4 100644 --- a/lib/pengine/tests/Makefile.am +++ b/lib/pengine/tests/Makefile.am @@ -1 +1,14 @@ -SUBDIRS = rules native status unpack utils +# +# Copyright 2020-2023 the Pacemaker project contributors +# +# The version control history for this file may have further details. +# +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. +# + +SUBDIRS = rules \ + native \ + status \ + unpack \ + utils diff --git a/lib/pengine/tests/native/Makefile.am b/lib/pengine/tests/native/Makefile.am index 5046ff1..07cc1a1 100644 --- a/lib/pengine/tests/native/Makefile.am +++ b/lib/pengine/tests/native/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2022 the Pacemaker project contributors +# Copyright 2022-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -17,6 +17,6 @@ AM_TESTS_ENVIRONMENT += PCMK_CTS_CLI_DIR=$(top_srcdir)/cts/cli # Add "_test" to the end of all test program names to simplify .gitignore. check_PROGRAMS = native_find_rsc_test \ - pe_base_name_eq_test + pe_base_name_eq_test TESTS = $(check_PROGRAMS) diff --git a/lib/pengine/tests/native/native_find_rsc_test.c b/lib/pengine/tests/native/native_find_rsc_test.c index 22aaf41..b85ca24 100644 --- a/lib/pengine/tests/native/native_find_rsc_test.c +++ b/lib/pengine/tests/native/native_find_rsc_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,21 +10,18 @@ #include <crm_internal.h> #include <crm/common/unittest_internal.h> +#include <crm/common/scheduler.h> #include <crm/common/xml.h> #include <crm/pengine/internal.h> #include <crm/pengine/status.h> -#include <crm/pengine/pe_types.h> - -/* Needed to access replicas inside a bundle. */ -#define PE__VARIANT_BUNDLE 1 -#include <lib/pengine/variant.h> xmlNode *input = NULL; -pe_working_set_t *data_set = NULL; +pcmk_scheduler_t *scheduler = NULL; -pe_node_t *cluster01, *cluster02, *httpd_bundle_0; -pe_resource_t *exim_group, *inactive_group, *promotable_clone, *inactive_clone; -pe_resource_t *httpd_bundle, *mysql_clone_group; +pcmk_node_t *cluster01, *cluster02, *httpd_bundle_0; +pcmk_resource_t *exim_group, *inactive_group; +pcmk_resource_t *promotable_clone, *inactive_clone; +pcmk_resource_t *httpd_bundle, *mysql_clone_group; static int setup(void **state) { @@ -40,25 +37,26 @@ setup(void **state) { return 1; } - data_set = pe_new_working_set(); + scheduler = pe_new_working_set(); - if (data_set == NULL) { + if (scheduler == NULL) { return 1; } - pe__set_working_set_flags(data_set, pe_flag_no_counts|pe_flag_no_compat); - data_set->input = input; + pe__set_working_set_flags(scheduler, + pcmk_sched_no_counts|pcmk_sched_no_compat); + scheduler->input = input; - cluster_status(data_set); + cluster_status(scheduler); /* Get references to the cluster nodes so we don't have to find them repeatedly. */ - cluster01 = pe_find_node(data_set->nodes, "cluster01"); - cluster02 = pe_find_node(data_set->nodes, "cluster02"); - httpd_bundle_0 = pe_find_node(data_set->nodes, "httpd-bundle-0"); + cluster01 = pe_find_node(scheduler->nodes, "cluster01"); + cluster02 = pe_find_node(scheduler->nodes, "cluster02"); + httpd_bundle_0 = pe_find_node(scheduler->nodes, "httpd-bundle-0"); /* Get references to several resources we use frequently. */ - for (GList *iter = data_set->resources; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + for (GList *iter = scheduler->resources; iter != NULL; iter = iter->next) { + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "exim-group") == 0) { exim_group = rsc; @@ -80,14 +78,14 @@ setup(void **state) { static int teardown(void **state) { - pe_free_working_set(data_set); + pe_free_working_set(scheduler); return 0; } static void bad_args(void **state) { - pe_resource_t *rsc = (pe_resource_t *) g_list_first(data_set->resources)->data; + pcmk_resource_t *rsc = g_list_first(scheduler->resources)->data; char *id = rsc->id; char *name = NULL; @@ -117,11 +115,11 @@ bad_args(void **state) { static void primitive_rsc(void **state) { - pe_resource_t *dummy = NULL; + pcmk_resource_t *dummy = NULL; /* Find the "dummy" resource, which is the only one with that ID in the set. */ - for (GList *iter = data_set->resources; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + for (GList *iter = scheduler->resources; iter != NULL; iter = iter->next) { + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "dummy") == 0) { dummy = rsc; @@ -133,20 +131,27 @@ primitive_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(dummy, native_find_rsc(dummy, "dummy", NULL, 0)); - assert_ptr_equal(dummy, native_find_rsc(dummy, "dummy", NULL, pe_find_current)); + assert_ptr_equal(dummy, + native_find_rsc(dummy, "dummy", NULL, + pcmk_rsc_match_current_node)); /* Fails because resource is not a clone (nor cloned). */ - assert_null(native_find_rsc(dummy, "dummy", NULL, pe_find_clone)); - assert_null(native_find_rsc(dummy, "dummy", cluster02, pe_find_clone)); + assert_null(native_find_rsc(dummy, "dummy", NULL, + pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(dummy, "dummy", cluster02, + pcmk_rsc_match_clone_only)); /* Fails because dummy is not running on cluster01, even with the right flags. */ - assert_null(native_find_rsc(dummy, "dummy", cluster01, pe_find_current)); + assert_null(native_find_rsc(dummy, "dummy", cluster01, + pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(dummy, "dummy", cluster02, 0)); /* Passes because dummy is running on cluster02. */ - assert_ptr_equal(dummy, native_find_rsc(dummy, "dummy", cluster02, pe_find_current)); + assert_ptr_equal(dummy, + native_find_rsc(dummy, "dummy", cluster02, + pcmk_rsc_match_current_node)); } static void @@ -155,20 +160,27 @@ group_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(exim_group, native_find_rsc(exim_group, "exim-group", NULL, 0)); - assert_ptr_equal(exim_group, native_find_rsc(exim_group, "exim-group", NULL, pe_find_current)); + assert_ptr_equal(exim_group, + native_find_rsc(exim_group, "exim-group", NULL, + pcmk_rsc_match_current_node)); /* Fails because resource is not a clone (nor cloned). */ - assert_null(native_find_rsc(exim_group, "exim-group", NULL, pe_find_clone)); - assert_null(native_find_rsc(exim_group, "exim-group", cluster01, pe_find_clone)); + assert_null(native_find_rsc(exim_group, "exim-group", NULL, + pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(exim_group, "exim-group", cluster01, + pcmk_rsc_match_clone_only)); /* Fails because none of exim-group's children are running on cluster01, even with the right flags. */ - assert_null(native_find_rsc(exim_group, "exim-group", cluster01, pe_find_current)); + assert_null(native_find_rsc(exim_group, "exim-group", cluster01, + pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(exim_group, "exim-group", cluster01, 0)); /* Passes because one of exim-group's children is running on cluster02. */ - assert_ptr_equal(exim_group, native_find_rsc(exim_group, "exim-group", cluster02, pe_find_current)); + assert_ptr_equal(exim_group, + native_find_rsc(exim_group, "exim-group", cluster02, + pcmk_rsc_match_current_node)); } static void @@ -177,30 +189,30 @@ inactive_group_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(inactive_group, native_find_rsc(inactive_group, "inactive-group", NULL, 0)); - assert_ptr_equal(inactive_group, native_find_rsc(inactive_group, "inactive-group", NULL, pe_find_current)); - assert_ptr_equal(inactive_group, native_find_rsc(inactive_group, "inactive-group", NULL, pe_find_inactive)); + assert_ptr_equal(inactive_group, + native_find_rsc(inactive_group, "inactive-group", NULL, + pcmk_rsc_match_current_node)); /* Fails because resource is not a clone (nor cloned). */ - assert_null(native_find_rsc(inactive_group, "inactive-group", NULL, pe_find_clone)); - assert_null(native_find_rsc(inactive_group, "inactive-group", cluster01, pe_find_clone)); + assert_null(native_find_rsc(inactive_group, "inactive-group", NULL, + pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(inactive_group, "inactive-group", cluster01, + pcmk_rsc_match_clone_only)); /* Fails because none of inactive-group's children are running. */ - assert_null(native_find_rsc(inactive_group, "inactive-group", cluster01, pe_find_current)); - assert_null(native_find_rsc(inactive_group, "inactive-group", cluster02, pe_find_current)); - - /* Passes because of flags. */ - assert_ptr_equal(inactive_group, native_find_rsc(inactive_group, "inactive-group", cluster01, pe_find_inactive)); - /* Passes because of flags. */ - assert_ptr_equal(inactive_group, native_find_rsc(inactive_group, "inactive-group", cluster02, pe_find_inactive)); + assert_null(native_find_rsc(inactive_group, "inactive-group", cluster01, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(inactive_group, "inactive-group", cluster02, + pcmk_rsc_match_current_node)); } static void group_member_rsc(void **state) { - pe_resource_t *public_ip = NULL; + pcmk_resource_t *public_ip = NULL; /* Find the "Public-IP" resource, a member of "exim-group". */ for (GList *iter = exim_group->children; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "Public-IP") == 0) { public_ip = rsc; @@ -212,29 +224,36 @@ group_member_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(public_ip, native_find_rsc(public_ip, "Public-IP", NULL, 0)); - assert_ptr_equal(public_ip, native_find_rsc(public_ip, "Public-IP", NULL, pe_find_current)); + assert_ptr_equal(public_ip, + native_find_rsc(public_ip, "Public-IP", NULL, + pcmk_rsc_match_current_node)); /* Fails because resource is not a clone (nor cloned). */ - assert_null(native_find_rsc(public_ip, "Public-IP", NULL, pe_find_clone)); - assert_null(native_find_rsc(public_ip, "Public-IP", cluster02, pe_find_clone)); + assert_null(native_find_rsc(public_ip, "Public-IP", NULL, + pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(public_ip, "Public-IP", cluster02, + pcmk_rsc_match_clone_only)); /* Fails because Public-IP is not running on cluster01, even with the right flags. */ - assert_null(native_find_rsc(public_ip, "Public-IP", cluster01, pe_find_current)); + assert_null(native_find_rsc(public_ip, "Public-IP", cluster01, + pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(public_ip, "Public-IP", cluster02, 0)); /* Passes because Public-IP is running on cluster02. */ - assert_ptr_equal(public_ip, native_find_rsc(public_ip, "Public-IP", cluster02, pe_find_current)); + assert_ptr_equal(public_ip, + native_find_rsc(public_ip, "Public-IP", cluster02, + pcmk_rsc_match_current_node)); } static void inactive_group_member_rsc(void **state) { - pe_resource_t *inactive_dummy_1 = NULL; + pcmk_resource_t *inactive_dummy_1 = NULL; /* Find the "inactive-dummy-1" resource, a member of "inactive-group". */ for (GList *iter = inactive_group->children; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "inactive-dummy-1") == 0) { inactive_dummy_1 = rsc; @@ -246,20 +265,21 @@ inactive_group_member_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(inactive_dummy_1, native_find_rsc(inactive_dummy_1, "inactive-dummy-1", NULL, 0)); - assert_ptr_equal(inactive_dummy_1, native_find_rsc(inactive_dummy_1, "inactive-dummy-1", NULL, pe_find_current)); + assert_ptr_equal(inactive_dummy_1, + native_find_rsc(inactive_dummy_1, "inactive-dummy-1", NULL, + pcmk_rsc_match_current_node)); /* Fails because resource is not a clone (nor cloned). */ - assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", NULL, pe_find_clone)); - assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster01, pe_find_clone)); + assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", NULL, + pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster01, + pcmk_rsc_match_clone_only)); /* Fails because inactive-dummy-1 is not running. */ - assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster01, pe_find_current)); - assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster02, pe_find_current)); - - /* Passes because of flags. */ - assert_ptr_equal(inactive_dummy_1, native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster01, pe_find_inactive)); - /* Passes because of flags. */ - assert_ptr_equal(inactive_dummy_1, native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster02, pe_find_inactive)); + assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster01, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(inactive_dummy_1, "inactive-dummy-1", cluster02, + pcmk_rsc_match_current_node)); } static void @@ -268,24 +288,40 @@ clone_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", NULL, 0)); - assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", NULL, pe_find_current)); - assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", NULL, pe_find_clone)); - - /* Fails because pe_find_current is required if a node is given. */ + assert_ptr_equal(promotable_clone, + native_find_rsc(promotable_clone, "promotable-clone", NULL, + pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_clone, + native_find_rsc(promotable_clone, "promotable-clone", NULL, + pcmk_rsc_match_clone_only)); + + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(promotable_clone, "promotable-clone", cluster01, 0)); /* Passes because one of ping-clone's children is running on cluster01. */ - assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", cluster01, pe_find_current)); + assert_ptr_equal(promotable_clone, + native_find_rsc(promotable_clone, "promotable-clone", + cluster01, pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(promotable_clone, "promotable-clone", cluster02, 0)); /* Passes because one of ping_clone's children is running on cluster02. */ - assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", cluster02, pe_find_current)); - - /* Passes for previous reasons, plus includes pe_find_clone check. */ - assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", cluster01, pe_find_clone|pe_find_current)); - assert_ptr_equal(promotable_clone, native_find_rsc(promotable_clone, "promotable-clone", cluster02, pe_find_clone|pe_find_current)); + assert_ptr_equal(promotable_clone, + native_find_rsc(promotable_clone, "promotable-clone", + cluster02, pcmk_rsc_match_current_node)); + + // Passes for previous reasons, plus includes pcmk_rsc_match_clone_only + assert_ptr_equal(promotable_clone, + native_find_rsc(promotable_clone, "promotable-clone", + cluster01, + pcmk_rsc_match_clone_only + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_clone, + native_find_rsc(promotable_clone, "promotable-clone", + cluster02, + pcmk_rsc_match_clone_only + |pcmk_rsc_match_current_node)); } static void @@ -294,28 +330,30 @@ inactive_clone_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(inactive_clone, native_find_rsc(inactive_clone, "inactive-clone", NULL, 0)); - assert_ptr_equal(inactive_clone, native_find_rsc(inactive_clone, "inactive-clone", NULL, pe_find_current)); - assert_ptr_equal(inactive_clone, native_find_rsc(inactive_clone, "inactive-clone", NULL, pe_find_clone)); - assert_ptr_equal(inactive_clone, native_find_rsc(inactive_clone, "inactive-clone", NULL, pe_find_inactive)); + assert_ptr_equal(inactive_clone, + native_find_rsc(inactive_clone, "inactive-clone", NULL, + pcmk_rsc_match_current_node)); + assert_ptr_equal(inactive_clone, + native_find_rsc(inactive_clone, "inactive-clone", NULL, + pcmk_rsc_match_clone_only)); /* Fails because none of inactive-clone's children are running. */ - assert_null(native_find_rsc(inactive_clone, "inactive-clone", cluster01, pe_find_current|pe_find_clone)); - assert_null(native_find_rsc(inactive_clone, "inactive-clone", cluster02, pe_find_current|pe_find_clone)); - - /* Passes because of flags. */ - assert_ptr_equal(inactive_clone, native_find_rsc(inactive_clone, "inactive-clone", cluster01, pe_find_inactive)); - /* Passes because of flags. */ - assert_ptr_equal(inactive_clone, native_find_rsc(inactive_clone, "inactive-clone", cluster02, pe_find_inactive)); + assert_null(native_find_rsc(inactive_clone, "inactive-clone", cluster01, + pcmk_rsc_match_current_node + |pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(inactive_clone, "inactive-clone", cluster02, + pcmk_rsc_match_current_node + |pcmk_rsc_match_clone_only)); } static void clone_instance_rsc(void **state) { - pe_resource_t *promotable_0 = NULL; - pe_resource_t *promotable_1 = NULL; + pcmk_resource_t *promotable_0 = NULL; + pcmk_resource_t *promotable_1 = NULL; /* Find the "promotable-rsc:0" and "promotable-rsc:1" resources, members of "promotable-clone". */ for (GList *iter = promotable_clone->children; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "promotable-rsc:0") == 0) { promotable_0 = rsc; @@ -329,70 +367,132 @@ clone_instance_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc:0", NULL, 0)); - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc:0", NULL, pe_find_current)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc:0", NULL, + pcmk_rsc_match_current_node)); assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc:1", NULL, 0)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc:1", NULL, pe_find_current)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc:1", NULL, + pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(promotable_0, "promotable-rsc:0", cluster02, 0)); assert_null(native_find_rsc(promotable_1, "promotable-rsc:1", cluster01, 0)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc:0", cluster02, pe_find_current)); - assert_null(native_find_rsc(promotable_0, "promotable-rsc:0", cluster01, pe_find_current)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc:1", cluster01, pe_find_current)); - assert_null(native_find_rsc(promotable_1, "promotable-rsc:1", cluster02, pe_find_current)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc:0", + cluster02, pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_0, "promotable-rsc:0", cluster01, + pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc:1", + cluster01, pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_1, "promotable-rsc:1", cluster02, + pcmk_rsc_match_current_node)); /* Passes because NULL was passed for node and primitive name was given, with correct flags. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc", NULL, pe_find_clone)); - - /* Passes because pe_find_any matches any instance's base name. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc", NULL, pe_find_any)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc", NULL, pe_find_any)); - - /* Passes because pe_find_anon matches. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc", NULL, pe_find_anon)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc", NULL, pe_find_anon)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc", NULL, + pcmk_rsc_match_clone_only)); + + // Passes because pcmk_rsc_match_basename matches any instance's base name + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc", NULL, + pcmk_rsc_match_basename)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc", NULL, + pcmk_rsc_match_basename)); + + // Passes because pcmk_rsc_match_anon_basename matches + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc", NULL, + pcmk_rsc_match_anon_basename)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc", NULL, + pcmk_rsc_match_anon_basename)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc", cluster02, pe_find_any|pe_find_current)); - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc", cluster02, pe_find_anon|pe_find_current)); - assert_null(native_find_rsc(promotable_0, "promotable-rsc", cluster01, pe_find_any|pe_find_current)); - assert_null(native_find_rsc(promotable_0, "promotable-rsc", cluster01, pe_find_anon|pe_find_current)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc", cluster01, pe_find_any|pe_find_current)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc", cluster01, pe_find_anon|pe_find_current)); - assert_null(native_find_rsc(promotable_1, "promotable-rsc", cluster02, pe_find_any|pe_find_current)); - assert_null(native_find_rsc(promotable_1, "promotable-rsc", cluster02, pe_find_anon|pe_find_current)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc", cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc", cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_0, "promotable-rsc", cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_0, "promotable-rsc", cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc", cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc", cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_1, "promotable-rsc", cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_1, "promotable-rsc", cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); /* Fails because incorrect flags were given along with primitive name. */ - assert_null(native_find_rsc(promotable_0, "promotable-rsc", NULL, pe_find_current)); - assert_null(native_find_rsc(promotable_1, "promotable-rsc", NULL, pe_find_current)); + assert_null(native_find_rsc(promotable_0, "promotable-rsc", NULL, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(promotable_1, "promotable-rsc", NULL, + pcmk_rsc_match_current_node)); /* And then we check failure possibilities again, except passing promotable_clone * instead of promotable_X as the first argument to native_find_rsc. */ - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(promotable_clone, "promotable-rsc:0", cluster02, 0)); assert_null(native_find_rsc(promotable_clone, "promotable-rsc:1", cluster01, 0)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_clone, "promotable-rsc:0", cluster02, pe_find_current)); - assert_ptr_equal(promotable_0, native_find_rsc(promotable_clone, "promotable-rsc", cluster02, pe_find_any|pe_find_current)); - assert_ptr_equal(promotable_0, native_find_rsc(promotable_clone, "promotable-rsc", cluster02, pe_find_anon|pe_find_current)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_clone, "promotable-rsc:1", cluster01, pe_find_current)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_clone, "promotable-rsc", cluster01, pe_find_any|pe_find_current)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_clone, "promotable-rsc", cluster01, pe_find_anon|pe_find_current)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_clone, "promotable-rsc:0", + cluster02, pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_clone, "promotable-rsc", + cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_clone, "promotable-rsc", + cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_clone, "promotable-rsc:1", + cluster01, pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_clone, "promotable-rsc", + cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_clone, "promotable-rsc", + cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); } static void renamed_rsc(void **state) { - pe_resource_t *promotable_0 = NULL; - pe_resource_t *promotable_1 = NULL; + pcmk_resource_t *promotable_0 = NULL; + pcmk_resource_t *promotable_1 = NULL; /* Find the "promotable-rsc:0" and "promotable-rsc:1" resources, members of "promotable-clone". */ for (GList *iter = promotable_clone->children; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "promotable-rsc:0") == 0) { promotable_0 = rsc; @@ -404,9 +504,13 @@ renamed_rsc(void **state) { assert_non_null(promotable_0); assert_non_null(promotable_1); - /* Passes because pe_find_renamed means the base name matches clone_name. */ - assert_ptr_equal(promotable_0, native_find_rsc(promotable_0, "promotable-rsc", NULL, pe_find_renamed)); - assert_ptr_equal(promotable_1, native_find_rsc(promotable_1, "promotable-rsc", NULL, pe_find_renamed)); + // Passes because pcmk_rsc_match_history means base name matches clone_name + assert_ptr_equal(promotable_0, + native_find_rsc(promotable_0, "promotable-rsc", NULL, + pcmk_rsc_match_history)); + assert_ptr_equal(promotable_1, + native_find_rsc(promotable_1, "promotable-rsc", NULL, + pcmk_rsc_match_history)); } static void @@ -415,36 +519,32 @@ bundle_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(httpd_bundle, native_find_rsc(httpd_bundle, "httpd-bundle", NULL, 0)); - assert_ptr_equal(httpd_bundle, native_find_rsc(httpd_bundle, "httpd-bundle", NULL, pe_find_current)); + assert_ptr_equal(httpd_bundle, + native_find_rsc(httpd_bundle, "httpd-bundle", NULL, + pcmk_rsc_match_current_node)); /* Fails because resource is not a clone (nor cloned). */ - assert_null(native_find_rsc(httpd_bundle, "httpd-bundle", NULL, pe_find_clone)); - assert_null(native_find_rsc(httpd_bundle, "httpd-bundle", cluster01, pe_find_clone)); + assert_null(native_find_rsc(httpd_bundle, "httpd-bundle", NULL, + pcmk_rsc_match_clone_only)); + assert_null(native_find_rsc(httpd_bundle, "httpd-bundle", cluster01, + pcmk_rsc_match_clone_only)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(httpd_bundle, "httpd-bundle", cluster01, 0)); /* Passes because one of httpd_bundle's children is running on cluster01. */ - assert_ptr_equal(httpd_bundle, native_find_rsc(httpd_bundle, "httpd-bundle", cluster01, pe_find_current)); + assert_ptr_equal(httpd_bundle, + native_find_rsc(httpd_bundle, "httpd-bundle", cluster01, + pcmk_rsc_match_current_node)); } -static void -bundle_replica_rsc(void **state) { - pe__bundle_variant_data_t *bundle_data = NULL; - pe__bundle_replica_t *replica_0 = NULL; - - pe_resource_t *ip_0 = NULL; - pe_resource_t *child_0 = NULL; - pe_resource_t *container_0 = NULL; - pe_resource_t *remote_0 = NULL; - - get_bundle_variant_data(bundle_data, httpd_bundle); - replica_0 = (pe__bundle_replica_t *) bundle_data->replicas->data; - - ip_0 = replica_0->ip; - child_0 = replica_0->child; - container_0 = replica_0->container; - remote_0 = replica_0->remote; +static bool +bundle_first_replica(pe__bundle_replica_t *replica, void *user_data) +{ + pcmk_resource_t *ip_0 = replica->ip; + pcmk_resource_t *child_0 = replica->child; + pcmk_resource_t *container_0 = replica->container; + pcmk_resource_t *remote_0 = replica->remote; assert_non_null(ip_0); assert_non_null(child_0); @@ -457,58 +557,109 @@ bundle_replica_rsc(void **state) { assert_ptr_equal(container_0, native_find_rsc(container_0, "httpd-bundle-docker-0", NULL, 0)); assert_ptr_equal(remote_0, native_find_rsc(remote_0, "httpd-bundle-0", NULL, 0)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", cluster01, 0)); assert_null(native_find_rsc(child_0, "httpd:0", httpd_bundle_0, 0)); assert_null(native_find_rsc(container_0, "httpd-bundle-docker-0", cluster01, 0)); assert_null(native_find_rsc(remote_0, "httpd-bundle-0", cluster01, 0)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(ip_0, native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", cluster01, pe_find_current)); - assert_null(native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", cluster02, pe_find_current)); - assert_null(native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", httpd_bundle_0, pe_find_current)); - assert_ptr_equal(child_0, native_find_rsc(child_0, "httpd:0", httpd_bundle_0, pe_find_current)); - assert_null(native_find_rsc(child_0, "httpd:0", cluster01, pe_find_current)); - assert_null(native_find_rsc(child_0, "httpd:0", cluster02, pe_find_current)); - assert_ptr_equal(container_0, native_find_rsc(container_0, "httpd-bundle-docker-0", cluster01, pe_find_current)); - assert_null(native_find_rsc(container_0, "httpd-bundle-docker-0", cluster02, pe_find_current)); - assert_null(native_find_rsc(container_0, "httpd-bundle-docker-0", httpd_bundle_0, pe_find_current)); - assert_ptr_equal(remote_0, native_find_rsc(remote_0, "httpd-bundle-0", cluster01, pe_find_current)); - assert_null(native_find_rsc(remote_0, "httpd-bundle-0", cluster02, pe_find_current)); - assert_null(native_find_rsc(remote_0, "httpd-bundle-0", httpd_bundle_0, pe_find_current)); - - /* Passes because pe_find_any matches any replica's base name. */ - assert_ptr_equal(child_0, native_find_rsc(child_0, "httpd", NULL, pe_find_any)); - - /* Passes because pe_find_anon matches. */ - assert_ptr_equal(child_0, native_find_rsc(child_0, "httpd", NULL, pe_find_anon)); + assert_ptr_equal(ip_0, + native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", + cluster01, pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", + cluster02, pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(ip_0, "httpd-bundle-ip-192.168.122.131", + httpd_bundle_0, pcmk_rsc_match_current_node)); + assert_ptr_equal(child_0, + native_find_rsc(child_0, "httpd:0", httpd_bundle_0, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(child_0, "httpd:0", cluster01, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(child_0, "httpd:0", cluster02, + pcmk_rsc_match_current_node)); + assert_ptr_equal(container_0, + native_find_rsc(container_0, "httpd-bundle-docker-0", + cluster01, pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(container_0, "httpd-bundle-docker-0", cluster02, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(container_0, "httpd-bundle-docker-0", + httpd_bundle_0, pcmk_rsc_match_current_node)); + assert_ptr_equal(remote_0, + native_find_rsc(remote_0, "httpd-bundle-0", cluster01, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(remote_0, "httpd-bundle-0", cluster02, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(remote_0, "httpd-bundle-0", httpd_bundle_0, + pcmk_rsc_match_current_node)); + + // Passes because pcmk_rsc_match_basename matches any replica's base name + assert_ptr_equal(child_0, + native_find_rsc(child_0, "httpd", NULL, + pcmk_rsc_match_basename)); + + // Passes because pcmk_rsc_match_anon_basename matches + assert_ptr_equal(child_0, + native_find_rsc(child_0, "httpd", NULL, + pcmk_rsc_match_anon_basename)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(child_0, native_find_rsc(child_0, "httpd", httpd_bundle_0, pe_find_any|pe_find_current)); - assert_ptr_equal(child_0, native_find_rsc(child_0, "httpd", httpd_bundle_0, pe_find_anon|pe_find_current)); - assert_null(native_find_rsc(child_0, "httpd", cluster01, pe_find_any|pe_find_current)); - assert_null(native_find_rsc(child_0, "httpd", cluster01, pe_find_anon|pe_find_current)); - assert_null(native_find_rsc(child_0, "httpd", cluster02, pe_find_any|pe_find_current)); - assert_null(native_find_rsc(child_0, "httpd", cluster02, pe_find_anon|pe_find_current)); + assert_ptr_equal(child_0, + native_find_rsc(child_0, "httpd", httpd_bundle_0, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(child_0, + native_find_rsc(child_0, "httpd", httpd_bundle_0, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(child_0, "httpd", cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(child_0, "httpd", cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(child_0, "httpd", cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(child_0, "httpd", cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); /* Fails because incorrect flags were given along with base name. */ - assert_null(native_find_rsc(child_0, "httpd", NULL, pe_find_current)); + assert_null(native_find_rsc(child_0, "httpd", NULL, + pcmk_rsc_match_current_node)); /* And then we check failure possibilities again, except passing httpd-bundle * instead of X_0 as the first argument to native_find_rsc. */ - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(httpd_bundle, "httpd-bundle-ip-192.168.122.131", cluster01, 0)); assert_null(native_find_rsc(httpd_bundle, "httpd:0", httpd_bundle_0, 0)); assert_null(native_find_rsc(httpd_bundle, "httpd-bundle-docker-0", cluster01, 0)); assert_null(native_find_rsc(httpd_bundle, "httpd-bundle-0", cluster01, 0)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(ip_0, native_find_rsc(httpd_bundle, "httpd-bundle-ip-192.168.122.131", cluster01, pe_find_current)); - assert_ptr_equal(child_0, native_find_rsc(httpd_bundle, "httpd:0", httpd_bundle_0, pe_find_current)); - assert_ptr_equal(container_0, native_find_rsc(httpd_bundle, "httpd-bundle-docker-0", cluster01, pe_find_current)); - assert_ptr_equal(remote_0, native_find_rsc(httpd_bundle, "httpd-bundle-0", cluster01, pe_find_current)); + assert_ptr_equal(ip_0, + native_find_rsc(httpd_bundle, + "httpd-bundle-ip-192.168.122.131", + cluster01, pcmk_rsc_match_current_node)); + assert_ptr_equal(child_0, + native_find_rsc(httpd_bundle, "httpd:0", httpd_bundle_0, + pcmk_rsc_match_current_node)); + assert_ptr_equal(container_0, + native_find_rsc(httpd_bundle, "httpd-bundle-docker-0", + cluster01, pcmk_rsc_match_current_node)); + assert_ptr_equal(remote_0, + native_find_rsc(httpd_bundle, "httpd-bundle-0", cluster01, + pcmk_rsc_match_current_node)); + return false; // Do not iterate through any further replicas +} + +static void +bundle_replica_rsc(void **state) +{ + pe__foreach_bundle_replica(httpd_bundle, bundle_first_replica, NULL); } static void @@ -517,34 +668,50 @@ clone_group_rsc(void **rsc) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", NULL, 0)); - assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", NULL, pe_find_current)); - assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", NULL, pe_find_clone)); - - /* Fails because pe_find_current is required if a node is given. */ + assert_ptr_equal(mysql_clone_group, + native_find_rsc(mysql_clone_group, "mysql-clone-group", + NULL, pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_clone_group, + native_find_rsc(mysql_clone_group, "mysql-clone-group", + NULL, pcmk_rsc_match_clone_only)); + + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(mysql_clone_group, "mysql-clone-group", cluster01, 0)); /* Passes because one of mysql-clone-group's children is running on cluster01. */ - assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", cluster01, pe_find_current)); + assert_ptr_equal(mysql_clone_group, + native_find_rsc(mysql_clone_group, "mysql-clone-group", + cluster01, pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(mysql_clone_group, "mysql-clone-group", cluster02, 0)); /* Passes because one of mysql-clone-group's children is running on cluster02. */ - assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", cluster02, pe_find_current)); - - /* Passes for previous reasons, plus includes pe_find_clone check. */ - assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", cluster01, pe_find_clone|pe_find_current)); - assert_ptr_equal(mysql_clone_group, native_find_rsc(mysql_clone_group, "mysql-clone-group", cluster02, pe_find_clone|pe_find_current)); + assert_ptr_equal(mysql_clone_group, + native_find_rsc(mysql_clone_group, "mysql-clone-group", + cluster02, pcmk_rsc_match_current_node)); + + // Passes for previous reasons, plus includes pcmk_rsc_match_clone_only + assert_ptr_equal(mysql_clone_group, + native_find_rsc(mysql_clone_group, "mysql-clone-group", + cluster01, + pcmk_rsc_match_clone_only + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_clone_group, + native_find_rsc(mysql_clone_group, "mysql-clone-group", + cluster02, + pcmk_rsc_match_clone_only + |pcmk_rsc_match_current_node)); } static void clone_group_instance_rsc(void **rsc) { - pe_resource_t *mysql_group_0 = NULL; - pe_resource_t *mysql_group_1 = NULL; + pcmk_resource_t *mysql_group_0 = NULL; + pcmk_resource_t *mysql_group_1 = NULL; /* Find the "mysql-group:0" and "mysql-group:1" resources, members of "mysql-clone-group". */ for (GList *iter = mysql_clone_group->children; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "mysql-group:0") == 0) { mysql_group_0 = rsc; @@ -558,73 +725,135 @@ clone_group_instance_rsc(void **rsc) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group:0", NULL, 0)); - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group:0", NULL, pe_find_current)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group:0", NULL, + pcmk_rsc_match_current_node)); assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group:1", NULL, 0)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group:1", NULL, pe_find_current)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_group_1, "mysql-group:1", NULL, + pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(mysql_group_0, "mysql-group:0", cluster02, 0)); assert_null(native_find_rsc(mysql_group_1, "mysql-group:1", cluster01, 0)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group:0", cluster02, pe_find_current)); - assert_null(native_find_rsc(mysql_group_0, "mysql-group:0", cluster01, pe_find_current)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group:1", cluster01, pe_find_current)); - assert_null(native_find_rsc(mysql_group_1, "mysql-group:1", cluster02, pe_find_current)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group:0", cluster02, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_0, "mysql-group:0", cluster01, + pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_group_1, "mysql-group:1", cluster01, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_1, "mysql-group:1", cluster02, + pcmk_rsc_match_current_node)); /* Passes because NULL was passed for node and base name was given, with correct flags. */ - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group" , NULL, pe_find_clone)); - - /* Passes because pe_find_any matches any base name. */ - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group" , NULL, pe_find_any)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group" , NULL, pe_find_any)); - - /* Passes because pe_find_anon matches. */ - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group" , NULL, pe_find_anon)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group" , NULL, pe_find_anon)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group" , NULL, + pcmk_rsc_match_clone_only)); + + // Passes because pcmk_rsc_match_basename matches any base name + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group" , NULL, + pcmk_rsc_match_basename)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_group_1, "mysql-group" , NULL, + pcmk_rsc_match_basename)); + + // Passes because pcmk_rsc_match_anon_basename matches + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group" , NULL, + pcmk_rsc_match_anon_basename)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_group_1, "mysql-group" , NULL, + pcmk_rsc_match_anon_basename)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group", cluster02, pe_find_any|pe_find_current)); - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_group_0, "mysql-group", cluster02, pe_find_anon|pe_find_current)); - assert_null(native_find_rsc(mysql_group_0, "mysql-group", cluster01, pe_find_any|pe_find_current)); - assert_null(native_find_rsc(mysql_group_0, "mysql-group", cluster01, pe_find_anon|pe_find_current)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group", cluster01, pe_find_any|pe_find_current)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_group_1, "mysql-group", cluster01, pe_find_anon|pe_find_current)); - assert_null(native_find_rsc(mysql_group_1, "mysql-group", cluster02, pe_find_any|pe_find_current)); - assert_null(native_find_rsc(mysql_group_1, "mysql-group", cluster02, pe_find_anon|pe_find_current)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group", cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_group_0, "mysql-group", cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_0, "mysql-group", cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_0, "mysql-group", cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_group_1, "mysql-group", cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_group_1, "mysql-group", cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_1, "mysql-group", cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_1, "mysql-group", cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); /* Fails because incorrect flags were given along with base name. */ - assert_null(native_find_rsc(mysql_group_0, "mysql-group", NULL, pe_find_current)); - assert_null(native_find_rsc(mysql_group_1, "mysql-group", NULL, pe_find_current)); + assert_null(native_find_rsc(mysql_group_0, "mysql-group", NULL, + pcmk_rsc_match_current_node)); + assert_null(native_find_rsc(mysql_group_1, "mysql-group", NULL, + pcmk_rsc_match_current_node)); /* And then we check failure possibilities again, except passing mysql_clone_group * instead of mysql_group_X as the first argument to native_find_rsc. */ - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(mysql_clone_group, "mysql-group:0", cluster02, 0)); assert_null(native_find_rsc(mysql_clone_group, "mysql-group:1", cluster01, 0)); /* Check that the resource is running on the node we expect. */ - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_clone_group, "mysql-group:0", cluster02, pe_find_current)); - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_clone_group, "mysql-group", cluster02, pe_find_any|pe_find_current)); - assert_ptr_equal(mysql_group_0, native_find_rsc(mysql_clone_group, "mysql-group", cluster02, pe_find_anon|pe_find_current)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_clone_group, "mysql-group:1", cluster01, pe_find_current)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_clone_group, "mysql-group", cluster01, pe_find_any|pe_find_current)); - assert_ptr_equal(mysql_group_1, native_find_rsc(mysql_clone_group, "mysql-group", cluster01, pe_find_anon|pe_find_current)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_clone_group, "mysql-group:0", + cluster02, pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_clone_group, "mysql-group", + cluster02, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_0, + native_find_rsc(mysql_clone_group, "mysql-group", + cluster02, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_clone_group, "mysql-group:1", + cluster01, pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_clone_group, "mysql-group", + cluster01, + pcmk_rsc_match_basename + |pcmk_rsc_match_current_node)); + assert_ptr_equal(mysql_group_1, + native_find_rsc(mysql_clone_group, "mysql-group", + cluster01, + pcmk_rsc_match_anon_basename + |pcmk_rsc_match_current_node)); } static void clone_group_member_rsc(void **state) { - pe_resource_t *mysql_proxy = NULL; + pcmk_resource_t *mysql_proxy = NULL; /* Find the "mysql-proxy" resource, a member of "mysql-group". */ for (GList *iter = mysql_clone_group->children; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "mysql-group:0") == 0) { for (GList *iter2 = rsc->children; iter2 != NULL; iter2 = iter2->next) { - pe_resource_t *child = (pe_resource_t *) iter2->data; + pcmk_resource_t *child = (pcmk_resource_t *) iter2->data; if (strcmp(child->id, "mysql-proxy:0") == 0) { mysql_proxy = child; @@ -640,24 +869,35 @@ clone_group_member_rsc(void **state) { /* Passes because NULL was passed for node, regardless of flags. */ assert_ptr_equal(mysql_proxy, native_find_rsc(mysql_proxy, "mysql-proxy:0", NULL, 0)); - assert_ptr_equal(mysql_proxy, native_find_rsc(mysql_proxy, "mysql-proxy:0", NULL, pe_find_current)); + assert_ptr_equal(mysql_proxy, + native_find_rsc(mysql_proxy, "mysql-proxy:0", NULL, + pcmk_rsc_match_current_node)); /* Passes because resource's parent is a clone. */ - assert_ptr_equal(mysql_proxy, native_find_rsc(mysql_proxy, "mysql-proxy:0", NULL, pe_find_clone)); - assert_ptr_equal(mysql_proxy, native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster02, pe_find_clone|pe_find_current)); + assert_ptr_equal(mysql_proxy, + native_find_rsc(mysql_proxy, "mysql-proxy:0", NULL, + pcmk_rsc_match_clone_only)); + assert_ptr_equal(mysql_proxy, + native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster02, + pcmk_rsc_match_clone_only + |pcmk_rsc_match_current_node)); /* Fails because mysql-proxy:0 is not running on cluster01, even with the right flags. */ - assert_null(native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster01, pe_find_current)); + assert_null(native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster01, + pcmk_rsc_match_current_node)); - /* Fails because pe_find_current is required if a node is given. */ + // Fails because pcmk_rsc_match_current_node is required if a node is given assert_null(native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster02, 0)); /* Passes because mysql-proxy:0 is running on cluster02. */ - assert_ptr_equal(mysql_proxy, native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster02, pe_find_current)); + assert_ptr_equal(mysql_proxy, + native_find_rsc(mysql_proxy, "mysql-proxy:0", cluster02, + pcmk_rsc_match_current_node)); } -/* TODO: Add tests for finding on allocated node (passing a node without - * pe_find_current, after scheduling, for a resource that is starting/stopping/moving. +/* TODO: Add tests for finding on assigned node (passing a node without + * pcmk_rsc_match_current_node, after scheduling, for a resource that is + * starting/stopping/moving. */ PCMK__UNIT_TEST(setup, teardown, cmocka_unit_test(bad_args), diff --git a/lib/pengine/tests/native/pe_base_name_eq_test.c b/lib/pengine/tests/native/pe_base_name_eq_test.c index 67a62f8..cb3c908 100644 --- a/lib/pengine/tests/native/pe_base_name_eq_test.c +++ b/lib/pengine/tests/native/pe_base_name_eq_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -12,15 +12,15 @@ #include <crm/common/unittest_internal.h> #include <crm/common/xml.h> +#include <crm/common/scheduler.h> #include <crm/pengine/internal.h> #include <crm/pengine/status.h> -#include <crm/pengine/pe_types.h> xmlNode *input = NULL; -pe_working_set_t *data_set = NULL; +pcmk_scheduler_t *scheduler = NULL; -pe_resource_t *exim_group, *promotable_0, *promotable_1, *dummy; -pe_resource_t *httpd_bundle, *mysql_group_0, *mysql_group_1; +pcmk_resource_t *exim_group, *promotable_0, *promotable_1, *dummy; +pcmk_resource_t *httpd_bundle, *mysql_group_0, *mysql_group_1; static int setup(void **state) { @@ -36,20 +36,21 @@ setup(void **state) { return 1; } - data_set = pe_new_working_set(); + scheduler = pe_new_working_set(); - if (data_set == NULL) { + if (scheduler == NULL) { return 1; } - pe__set_working_set_flags(data_set, pe_flag_no_counts|pe_flag_no_compat); - data_set->input = input; + pe__set_working_set_flags(scheduler, + pcmk_sched_no_counts|pcmk_sched_no_compat); + scheduler->input = input; - cluster_status(data_set); + cluster_status(scheduler); /* Get references to several resources we use frequently. */ - for (GList *iter = data_set->resources; iter != NULL; iter = iter->next) { - pe_resource_t *rsc = (pe_resource_t *) iter->data; + for (GList *iter = scheduler->resources; iter != NULL; iter = iter->next) { + pcmk_resource_t *rsc = (pcmk_resource_t *) iter->data; if (strcmp(rsc->id, "dummy") == 0) { dummy = rsc; @@ -59,7 +60,7 @@ setup(void **state) { httpd_bundle = rsc; } else if (strcmp(rsc->id, "mysql-clone-group") == 0) { for (GList *iter = rsc->children; iter != NULL; iter = iter->next) { - pe_resource_t *child = (pe_resource_t *) iter->data; + pcmk_resource_t *child = (pcmk_resource_t *) iter->data; if (strcmp(child->id, "mysql-group:0") == 0) { mysql_group_0 = child; @@ -69,7 +70,7 @@ setup(void **state) { } } else if (strcmp(rsc->id, "promotable-clone") == 0) { for (GList *iter = rsc->children; iter != NULL; iter = iter->next) { - pe_resource_t *child = (pe_resource_t *) iter->data; + pcmk_resource_t *child = (pcmk_resource_t *) iter->data; if (strcmp(child->id, "promotable-rsc:0") == 0) { promotable_0 = child; @@ -85,7 +86,7 @@ setup(void **state) { static int teardown(void **state) { - pe_free_working_set(data_set); + pe_free_working_set(scheduler); return 0; } diff --git a/lib/pengine/tests/status/Makefile.am b/lib/pengine/tests/status/Makefile.am index 3f95496..c7ddb70 100644 --- a/lib/pengine/tests/status/Makefile.am +++ b/lib/pengine/tests/status/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2022 the Pacemaker project contributors +# Copyright 2022-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -13,10 +13,10 @@ include $(top_srcdir)/mk/unittest.mk LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la # Add "_test" to the end of all test program names to simplify .gitignore. -check_PROGRAMS = pe_find_node_any_test \ - pe_find_node_id_test \ - pe_find_node_test \ - pe_new_working_set_test \ - set_working_set_defaults_test +check_PROGRAMS = pe_find_node_any_test \ + pe_find_node_id_test \ + pe_find_node_test \ + pe_new_working_set_test \ + set_working_set_defaults_test TESTS = $(check_PROGRAMS) diff --git a/lib/pengine/tests/status/pe_find_node_any_test.c b/lib/pengine/tests/status/pe_find_node_any_test.c index b911424..5f5a27e 100644 --- a/lib/pengine/tests/status/pe_find_node_any_test.c +++ b/lib/pengine/tests/status/pe_find_node_any_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -24,8 +24,8 @@ static void non_null_list(void **state) { GList *nodes = NULL; - pe_node_t *a = calloc(1, sizeof(pe_node_t)); - pe_node_t *b = calloc(1, sizeof(pe_node_t)); + pcmk_node_t *a = calloc(1, sizeof(pcmk_node_t)); + pcmk_node_t *b = calloc(1, sizeof(pcmk_node_t)); a->details = calloc(1, sizeof(struct pe_node_shared_s)); a->details->uname = "cluster1"; diff --git a/lib/pengine/tests/status/pe_find_node_id_test.c b/lib/pengine/tests/status/pe_find_node_id_test.c index 832a40a..c6b8773 100644 --- a/lib/pengine/tests/status/pe_find_node_id_test.c +++ b/lib/pengine/tests/status/pe_find_node_id_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -22,8 +22,8 @@ static void non_null_list(void **state) { GList *nodes = NULL; - pe_node_t *a = calloc(1, sizeof(pe_node_t)); - pe_node_t *b = calloc(1, sizeof(pe_node_t)); + pcmk_node_t *a = calloc(1, sizeof(pcmk_node_t)); + pcmk_node_t *b = calloc(1, sizeof(pcmk_node_t)); a->details = calloc(1, sizeof(struct pe_node_shared_s)); a->details->id = "id1"; diff --git a/lib/pengine/tests/status/pe_find_node_test.c b/lib/pengine/tests/status/pe_find_node_test.c index 7c7ea30..305ddc9 100644 --- a/lib/pengine/tests/status/pe_find_node_test.c +++ b/lib/pengine/tests/status/pe_find_node_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -22,8 +22,8 @@ static void non_null_list(void **state) { GList *nodes = NULL; - pe_node_t *a = calloc(1, sizeof(pe_node_t)); - pe_node_t *b = calloc(1, sizeof(pe_node_t)); + pcmk_node_t *a = calloc(1, sizeof(pcmk_node_t)); + pcmk_node_t *b = calloc(1, sizeof(pcmk_node_t)); a->details = calloc(1, sizeof(struct pe_node_shared_s)); a->details->uname = "cluster1"; diff --git a/lib/pengine/tests/status/pe_new_working_set_test.c b/lib/pengine/tests/status/pe_new_working_set_test.c index cf2df4f..b385f9c 100644 --- a/lib/pengine/tests/status/pe_new_working_set_test.c +++ b/lib/pengine/tests/status/pe_new_working_set_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -19,7 +19,7 @@ calloc_fails(void **state) { pcmk__mock_calloc = true; // calloc() will return NULL expect_value(__wrap_calloc, nmemb, 1); - expect_value(__wrap_calloc, size, sizeof(pe_working_set_t)); + expect_value(__wrap_calloc, size, sizeof(pcmk_scheduler_t)); assert_null(pe_new_working_set()); pcmk__mock_calloc = false; // Use real calloc() @@ -27,18 +27,18 @@ calloc_fails(void **state) { static void calloc_succeeds(void **state) { - pe_working_set_t *data_set = pe_new_working_set(); + pcmk_scheduler_t *scheduler = pe_new_working_set(); /* Nothing else to test about this function, as all it does is call * set_working_set_defaults which is also a public function and should * get its own unit test. */ - assert_non_null(data_set); + assert_non_null(scheduler); /* Avoid calling pe_free_working_set here so we don't artificially * inflate the coverage numbers. */ - free(data_set); + free(scheduler); } PCMK__UNIT_TEST(NULL, NULL, diff --git a/lib/pengine/tests/status/set_working_set_defaults_test.c b/lib/pengine/tests/status/set_working_set_defaults_test.c index c822278..7045a33 100644 --- a/lib/pengine/tests/status/set_working_set_defaults_test.c +++ b/lib/pengine/tests/status/set_working_set_defaults_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,8 +10,9 @@ #include <crm_internal.h> #include <crm/common/unittest_internal.h> + +#include <crm/common/scheduler.h> #include <crm/pengine/internal.h> -#include <crm/pengine/pe_types.h> #include <crm/pengine/status.h> #include "mock_private.h" @@ -19,27 +20,29 @@ static void check_defaults(void **state) { uint32_t flags; - pe_working_set_t *data_set = calloc(1, sizeof(pe_working_set_t)); + pcmk_scheduler_t *scheduler = calloc(1, sizeof(pcmk_scheduler_t)); - set_working_set_defaults(data_set); + set_working_set_defaults(scheduler); - flags = pe_flag_stop_rsc_orphans|pe_flag_symmetric_cluster|pe_flag_stop_action_orphans; + flags = pcmk_sched_symmetric_cluster + |pcmk_sched_stop_removed_resources + |pcmk_sched_cancel_removed_actions; if (!strcmp(PCMK__CONCURRENT_FENCING_DEFAULT, "true")) { - flags |= pe_flag_concurrent_fencing; + flags |= pcmk_sched_concurrent_fencing; } - assert_null(data_set->priv); - assert_int_equal(data_set->order_id, 1); - assert_int_equal(data_set->action_id, 1); - assert_int_equal(data_set->no_quorum_policy, no_quorum_stop); - assert_int_equal(data_set->flags, flags); + assert_null(scheduler->priv); + assert_int_equal(scheduler->order_id, 1); + assert_int_equal(scheduler->action_id, 1); + assert_int_equal(scheduler->no_quorum_policy, pcmk_no_quorum_stop); + assert_int_equal(scheduler->flags, flags); /* Avoid calling pe_free_working_set here so we don't artificially * inflate the coverage numbers. */ - free(data_set); + free(scheduler); } PCMK__UNIT_TEST(NULL, NULL, diff --git a/lib/pengine/tests/utils/Makefile.am b/lib/pengine/tests/utils/Makefile.am index 4a3e8a2..64421e2 100644 --- a/lib/pengine/tests/utils/Makefile.am +++ b/lib/pengine/tests/utils/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2022 the Pacemaker project contributors +# Copyright 2022-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -14,8 +14,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/lib/pengine LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la # Add "_test" to the end of all test program names to simplify .gitignore. -check_PROGRAMS = \ - pe__cmp_node_name_test \ +check_PROGRAMS = pe__cmp_node_name_test \ pe__cmp_rsc_priority_test TESTS = $(check_PROGRAMS) diff --git a/lib/pengine/tests/utils/pe__cmp_node_name_test.c b/lib/pengine/tests/utils/pe__cmp_node_name_test.c index 45d87ee..4d602e4 100644 --- a/lib/pengine/tests/utils/pe__cmp_node_name_test.c +++ b/lib/pengine/tests/utils/pe__cmp_node_name_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 the Pacemaker project contributors + * Copyright 2022-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -15,8 +15,8 @@ struct pe_node_shared_s node1_details; struct pe_node_shared_s node2_details; -pe_node_t node1 = {.details = &node1_details}; -pe_node_t node2 = {.details = &node2_details}; +pcmk_node_t node1 = { .details = &node1_details }; +pcmk_node_t node2 = { .details = &node2_details }; static void nodes_equal(void **state) diff --git a/lib/pengine/tests/utils/pe__cmp_rsc_priority_test.c b/lib/pengine/tests/utils/pe__cmp_rsc_priority_test.c index 669e7a9..24c1731 100644 --- a/lib/pengine/tests/utils/pe__cmp_rsc_priority_test.c +++ b/lib/pengine/tests/utils/pe__cmp_rsc_priority_test.c @@ -14,8 +14,8 @@ #include "pe_status_private.h" -pe_resource_t rsc1; -pe_resource_t rsc2; +pcmk_resource_t rsc1; +pcmk_resource_t rsc2; static void rscs_equal(void **state) |