Skip to content

Commit 5a6d3ae

Browse files
authored
Fix Glob suffixTest (elastic#133282)
If suffix contained a '#' then suffix + '#' + randomString() could end with suffix (even if the randomString did not equal suffix)
1 parent 20bd151 commit 5a6d3ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libs/core/src/test/java/org/elasticsearch/core/GlobTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ public void testSuffixMatch() {
9696
var pattern = "*" + suffix;
9797
assertMatch(pattern, suffix);
9898
assertMatch(pattern, randomAsciiString(randomIntBetween(1, 30)) + suffix);
99-
assertNonMatch(pattern, suffix + "#" + randomValueOtherThan(suffix, () -> randomAsciiString(randomIntBetween(1, 30))));
99+
assertNonMatch(
100+
pattern,
101+
randomValueOtherThanMany(str -> str.endsWith(suffix), () -> suffix + "#" + randomAsciiString(randomIntBetween(1, 30)))
102+
);
100103
assertNonMatch(pattern, suffix.substring(0, suffix.length() - 1));
101104
assertNonMatch(pattern, suffix.substring(1));
102105
}

0 commit comments

Comments
 (0)