Skip to content
Merged
Show file tree
Hide file tree
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 @@ -175,9 +175,13 @@ CloudBlobClient getSelectedClient(String account, LocationMode mode) {
return client;
}

private OperationContext generateOperationContext(String clientName) {
// Package private for testing in 6.x only: not needed anymore after
OperationContext generateOperationContext(String clientName) {
OperationContext context = new OperationContext();
AzureStorageSettings azureStorageSettings = this.storageSettings.get(clientName);
if (azureStorageSettings == null) {
azureStorageSettings = deprecatedStorageSettings.get(clientName);
}

if (azureStorageSettings.getProxy() != null) {
context.setProxy(azureStorageSettings.getProxy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,11 @@ public void testGetDefaultClientWithPrimaryAndSecondaries() {
}

@Deprecated
public void testGetSelectedClientDefault() {
public void testGenerateOperationContext() {
AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(deprecatedSettings);
CloudBlobClient client = azureStorageService.getSelectedClient("default", LocationMode.PRIMARY_ONLY);
assertThat(client.getEndpoint(), is(URI.create("https://azure1")));
// This was producing a NPE when calling any operation with deprecated settings.
// See https://github.com/elastic/elasticsearch/issues/28299
azureStorageService.generateOperationContext("default");
assertDeprecatedWarnings();
}

Expand Down