Fix mutator in GetRolesRequestTests (#35932)

There was no guarantee that the mutated object would not be the same
as the original object (and was for seed 6A8C4CBF63B5AA63)

Resolves #35947
This commit is contained in:
Tim Vernum 2018-11-28 01:10:14 +11:00 committed by Ioannis Kakavas
parent cb8646ac0e
commit 8d9e21ffaa

View File

@ -47,6 +47,7 @@ public class GetRolesRequestTests extends ESTestCase {
}
private static GetRolesRequest mutateTestItem(GetRolesRequest original) {
return new GetRolesRequest(randomArray(0, 5, String[]::new, () -> randomAlphaOfLength(5)));
final int minRoles = original.getRoleNames().isEmpty() ? 1 : 0;
return new GetRolesRequest(randomArray(minRoles, 5, String[]::new, () -> randomAlphaOfLength(6)));
}
}