Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Reduce concurrency when testing creation of security index #75293

Merged
merged 4 commits into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ public class SecurityIndexManagerIntegTests extends SecurityIntegTestCase {
public void testConcurrentOperationsTryingToCreateSecurityIndexAndAlias() throws Exception {
assertSecurityIndexActive();
final int processors = Runtime.getRuntime().availableProcessors();
final int numThreads = scaledRandomIntBetween((processors + 1) / 2, 4 * processors);
final int maxNumRequests = 100 / numThreads; // bound to a maximum of 100 requests
final int numThreads = Math.min(50, scaledRandomIntBetween((processors + 1) / 2, 4 * processors)); // up to 50 threads
final int maxNumRequests = 50 / numThreads; // bound to a maximum of 50 requests
Comment on lines +30 to +31
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also choose to reduce the concurrency only when the test is inFipsJvm since the build stats show that all failures so far are for FIPS jobs.

final int numRequests = scaledRandomIntBetween(Math.min(4, maxNumRequests), maxNumRequests);
logger.info("creating users with [{}] threads, each sending [{}] requests", numThreads, numRequests);

final List<ActionFuture<PutUserResponse>> futures = new CopyOnWriteArrayList<>();
final List<Exception> exceptions = new CopyOnWriteArrayList<>();
Expand Down Expand Up @@ -71,7 +72,10 @@ protected void doRun() throws Exception {
assertThat(exceptions, Matchers.empty());
assertEquals(futures.size(), numRequests * numThreads);
for (ActionFuture<PutUserResponse> future : futures) {
assertTrue(future.actionGet().created());
// In rare cases, the user could be updated instead of created. For the purpose of
// this test, either created or updated is sufficient to prove that the security
// index is created. So we don't need to assert the value.
future.actionGet().created();
}
}

Expand Down