[dm-devel] [PATCH 03/16] tests: add path grouping policy unit tests.

Martin Wilck Martin.Wilck at suse.com
Wed Aug 14 21:22:17 UTC 2019


On Fri, 2019-08-02 at 11:33 -0500, Benjamin Marzinski wrote:
> In preparation for changing the path grouping code, add some unit
> tests
> to verify that it works correctly. The only test that currently fails
> (and so it being skipped) is using MULTIBUS when mp->paths is empty.
> All
> the other path grouping policies free mp->paths, even if it is empty.
> one_group() should as well. This will be fixed when the path grouping
> code is updated.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
>  tests/Makefile   |   2 +-
>  tests/pgpolicy.c | 708
> +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 709 insertions(+), 1 deletion(-)
>  create mode 100644 tests/pgpolicy.c
> 
> +
> +static void test_group_by_node_name_3_groups4(void **state)
> +{
> +	char *node_name[] = {"a","b","c","a"};
> +	int prio[] = {3,1,3,1};
> +	int group0[] = {2};
> +	int group1[] = {0,3};
> +	int group2[] = {1};
> +	int *groups[] = {group0, group1, group2};
> +	int group_size[] = {1,2,1};
> +
> +	set_priority(p4, prio, 4);
> +	set_tgt_node_name(p4, node_name, 4);
> +	assert_int_equal(group_by_node_name(&mp4), 0);
> +	verify_pathgroups(&mp4, p4, groups, group_size, 3);
> +}

Nothing wrong with your code, but this is one example where I would say
our prio group ordering is counter-intuitive. Does it really make sense
to order the group of two paths with prio {3, 1} *after* the group with
just one prio 3 path?

Regards,
Martin





More information about the dm-devel mailing list