Skip to content

Commit

Permalink
Fix ProfileIntegTests (elastic#117888) (elastic#118059)
Browse files Browse the repository at this point in the history
The test setup for `ProfileIntegTests` is flawed, where the full name of
a user can be a substring of other profile names (e.g., `SER` is a
substring of `User <random-string>-space1`) -- when that's passed into
suggest call with the `*` space, we get a match on all profiles, instead
of only the one profile expected in the test, since we are matching on
e.g. `SER*`. This PR restricts the setup to avoid the wildcard profile
for that particular test.

Closes: elastic#117782
  • Loading branch information
n1v0lg authored Dec 16, 2024
1 parent 832fb69 commit 187aecf
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,11 @@ public void testSuggestProfilesWithHint() throws IOException {
equalTo(profileHits4.subList(2, profileHits4.size()))
);

// Exclude profile for "*" space since that can match _all_ profiles, if the full name is a substring of "user" or the name of
// another profile
final List<Profile> nonWildcardProfiles = profiles.stream().filter(p -> false == p.user().fullName().endsWith("*")).toList();
// A record will not be included if name does not match even when it has matching hint
final Profile hintedProfile5 = randomFrom(profiles);
final Profile hintedProfile5 = randomFrom(nonWildcardProfiles);
final List<Profile> profileHits5 = Arrays.stream(
doSuggest(
Set.of(),
Expand Down

0 comments on commit 187aecf

Please sign in to comment.