3131import org .elasticsearch .common .unit .ByteSizeUnit ;
3232import org .elasticsearch .common .unit .ByteSizeValue ;
3333import org .elasticsearch .core .SuppressForbidden ;
34+ import org .elasticsearch .core .TimeValue ;
3435import org .elasticsearch .plugins .Plugin ;
3536import org .elasticsearch .plugins .PluginsService ;
3637import org .elasticsearch .repositories .RepositoriesService ;
4142import org .elasticsearch .telemetry .Measurement ;
4243import org .elasticsearch .telemetry .TestTelemetryPlugin ;
4344import org .elasticsearch .test .BackgroundIndexer ;
45+ import org .elasticsearch .threadpool .ThreadPool ;
4446
4547import java .io .ByteArrayInputStream ;
4648import java .io .IOException ;
5355import java .util .HashMap ;
5456import java .util .List ;
5557import java .util .Map ;
58+ import java .util .concurrent .atomic .AtomicInteger ;
5659import java .util .function .Predicate ;
5760import java .util .regex .Pattern ;
5861import java .util .stream .Collectors ;
@@ -75,6 +78,8 @@ public class AzureBlobStoreRepositoryTests extends ESMockAPIBasedRepositoryInteg
7578 protected static final String DEFAULT_ACCOUNT_NAME = "account" ;
7679 protected static final Predicate <String > LIST_PATTERN = Pattern .compile ("GET /[a-zA-Z0-9]+/[a-zA-Z0-9]+\\ ?.+" ).asMatchPredicate ();
7780 protected static final Predicate <String > GET_BLOB_PATTERN = Pattern .compile ("GET /[a-zA-Z0-9]+/[a-zA-Z0-9]+/.+" ).asMatchPredicate ();
81+ private static final AtomicInteger MAX_CONNECTION_SETTING = new AtomicInteger (-1 );
82+ private static final AtomicInteger EVENT_LOOP_THREAD_COUNT_SETTING = new AtomicInteger (-1 );
7883
7984 @ Override
8085 protected String repositoryType () {
@@ -132,9 +137,17 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
132137
133138 // see com.azure.storage.blob.BlobUrlParts.parseIpUrl
134139 final String endpoint = "ignored;DefaultEndpointsProtocol=http;BlobEndpoint=" + httpServerUrl () + "/" + accountName ;
140+
141+ // The first node configured sets these for all nodes
142+ MAX_CONNECTION_SETTING .compareAndSet (-1 , randomIntBetween (10 , 30 ));
143+ EVENT_LOOP_THREAD_COUNT_SETTING .compareAndSet (-1 , randomIntBetween (1 , 3 ));
135144 return Settings .builder ()
136145 .put (super .nodeSettings (nodeOrdinal , otherSettings ))
137146 .put (AzureStorageSettings .ENDPOINT_SUFFIX_SETTING .getConcreteSettingForNamespace ("test" ).getKey (), endpoint )
147+ .put (AzureClientProvider .EVENT_LOOP_THREAD_COUNT .getKey (), EVENT_LOOP_THREAD_COUNT_SETTING .get ())
148+ .put (AzureClientProvider .MAX_OPEN_CONNECTIONS .getKey (), MAX_CONNECTION_SETTING .get ())
149+ .put (AzureClientProvider .MAX_IDLE_TIME .getKey (), TimeValue .timeValueSeconds (randomIntBetween (10 , 30 )))
150+ .put (AzureClientProvider .OPEN_CONNECTION_TIMEOUT .getKey (), TimeValue .timeValueSeconds (randomIntBetween (10 , 30 )))
138151 .setSecureSettings (secureSettings )
139152 .build ();
140153 }
@@ -262,6 +275,16 @@ private boolean isPutBlockList(String request) {
262275 }
263276 }
264277
278+ public void testSettingsTakeEffect () {
279+ AzureClientProvider azureClientProvider = internalCluster ().getInstance (AzureClientProvider .class );
280+ assertEquals (MAX_CONNECTION_SETTING .get (), azureClientProvider .getConnectionProvider ().maxConnections ());
281+ ThreadPool nodeThreadPool = internalCluster ().getInstance (ThreadPool .class );
282+ assertEquals (
283+ EVENT_LOOP_THREAD_COUNT_SETTING .get (),
284+ nodeThreadPool .info (AzureRepositoryPlugin .NETTY_EVENT_LOOP_THREAD_POOL_NAME ).getMax ()
285+ );
286+ }
287+
265288 public void testLargeBlobCountDeletion () throws Exception {
266289 int numberOfBlobs = randomIntBetween (257 , 2000 );
267290 try (BlobStore store = newBlobStore ()) {
0 commit comments