device-mapper-multipath/0023-multipath-tools-tests-fix-alias-test-after-sort-orde.patch
Benjamin Marzinski e5eddaae1a device-mapper-multipath-0.9.6-1
Update to the head of the upstream staging branch
Rename redhat patches
  * Previous patches 0001-0012 are now patches 0041-0052
Add 0053-RH-Add-mpathcleanup.patch
  * add mpathcleanup program
2023-09-22 15:29:43 -05:00

91 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 8 Sep 2023 15:46:02 +0200
Subject: [PATCH] multipath-tools tests: fix alias test after sort order change
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/alias.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/tests/alias.c b/tests/alias.c
index d1cc487b..8ed95d7a 100644
--- a/tests/alias.c
+++ b/tests/alias.c
@@ -932,16 +932,15 @@ static void lb_nomatch_b_a_aa_zz(void **state)
/*
* add_bindings() sorts alphabetically. ("a", "aa", "ab", "b", "c", ...)
- * lookup_binding finds MPATHaaa as next free entry, because MPATHaa is
- * found before MPATHb, and MPATHzz was in the bindings, too.
+ * lookup_binding finds MPATHab as next free entry.
*/
fill_bindings(&buf, 0, 26);
print_strbuf(&buf, "MPATHzz WWID676\n");
mock_bindings_file(get_strbuf_str(&buf));
expect_condlog(3, NOMATCH_WWID_STR("WWID703"));
- mock_unused_alias("MPATHaaa");
+ mock_unused_alias("MPATHab");
rc = lookup_binding(NULL, "WWID703", &alias, "MPATH", 1);
- assert_int_equal(rc, 703);
+ assert_int_equal(rc, 28);
assert_ptr_equal(alias, NULL);
}
@@ -998,13 +997,8 @@ static void lb_nomatch_b_a_3_used(void **state)
#ifdef MPATH_ID_INT_MAX
/*
- * The bindings will be sorted by alias, alphabetically, which is not
- * the same as the "numeric" sort order for user-friendly aliases.
- * get_free_id() selects the highest used ID + 1 if an unsorted entry
- * is encountered in the bindings table and it's id is equal to the
- * next "expected" id. This happens if all IDs from "a" to "aa" are
- * in the table. If the INT_MAX entry is in the table, too, it will
- * overflow.
+ * The bindings will be sorted by alias. Therefore we have no chance to
+ * simulate a "full" table.
*/
static void lb_nomatch_int_max(void **state)
{
@@ -1016,9 +1010,9 @@ static void lb_nomatch_int_max(void **state)
print_strbuf(&buf, "MPATH%s WWIDMAX\n", MPATH_ID_INT_MAX);
mock_bindings_file(get_strbuf_str(&buf));
expect_condlog(3, NOMATCH_WWID_STR("WWIDNOMORE"));
- expect_condlog(0, NOMORE_STR);
+ mock_unused_alias("MPATHab");
rc = lookup_binding(NULL, "WWIDNOMORE", &alias, "MPATH", 1);
- assert_int_equal(rc, -1);
+ assert_int_equal(rc, 28);
assert_ptr_equal(alias, NULL);
}
@@ -1049,9 +1043,9 @@ static void lb_nomatch_int_max_m1(void **state)
print_strbuf(&buf, "MPATH%s WWIDMAXM1\n", MPATH_ID_INT_MAX_m1);
mock_bindings_file(get_strbuf_str(&buf));
expect_condlog(3, NOMATCH_WWID_STR("WWIDMAX"));
- mock_unused_alias("MPATH" MPATH_ID_INT_MAX);
+ mock_unused_alias("MPATHab");
rc = lookup_binding(NULL, "WWIDMAX", &alias, "MPATH", 1);
- assert_int_equal(rc, INT_MAX);
+ assert_int_equal(rc, 28);
assert_ptr_equal(alias, NULL);
}
@@ -1065,10 +1059,10 @@ static void lb_nomatch_int_max_m1_used(void **state)
print_strbuf(&buf, "MPATH%s WWIDMAXM1\n", MPATH_ID_INT_MAX_m1);
mock_bindings_file(get_strbuf_str(&buf));
expect_condlog(3, NOMATCH_WWID_STR("WWIDMAX"));
- mock_used_alias("MPATH" MPATH_ID_INT_MAX, "WWIDMAX");
- expect_condlog(0, NOMORE_STR);
+ mock_used_alias("MPATHab", "WWIDMAX");
+ mock_unused_alias("MPATHac");
rc = lookup_binding(NULL, "WWIDMAX", &alias, "MPATH", 1);
- assert_int_equal(rc, -1);
+ assert_int_equal(rc, 29);
assert_ptr_equal(alias, NULL);
}