Skip to content

Commit

Permalink
Take into account base path on AzureBlobStoreRepositoryTests#testNotF…
Browse files Browse the repository at this point in the history
…oundErrorMessageContainsFullKey (#75936)

Backport of #75934
Co-authored-by: Francisco Fernández Castaño <[email protected]>
  • Loading branch information
elasticsearchmachine authored Aug 2, 2021
1 parent 8ec5c2f commit 3f2c3e4
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
*/
package org.elasticsearch.repositories.azure;

import fixture.azure.AzureHttpHandler;

import com.azure.storage.common.policy.RequestRetryOptions;
import com.azure.storage.common.policy.RetryPolicyType;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import fixture.azure.AzureHttpHandler;

import org.elasticsearch.common.Randomness;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.common.blobstore.BlobContainer;
import org.elasticsearch.common.blobstore.BlobPath;
import org.elasticsearch.common.blobstore.BlobStore;
Expand All @@ -24,6 +25,7 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.repositories.blobstore.ESMockAPIBasedRepositoryIntegTestCase;
import org.elasticsearch.rest.RestStatus;
Expand All @@ -40,7 +42,7 @@
import java.util.regex.Pattern;

import static org.hamcrest.Matchers.anEmptyMap;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

@SuppressForbidden(reason = "this test uses a HttpServer to emulate an Azure endpoint")
Expand Down Expand Up @@ -249,7 +251,7 @@ public void testNotFoundErrorMessageContainsFullKey() throws Exception {
try (BlobStore store = newBlobStore()) {
BlobContainer container = store.blobContainer(BlobPath.EMPTY.add("nested").add("dir"));
NoSuchFileException exception = expectThrows(NoSuchFileException.class, () -> container.readBlob("blob"));
assertThat(exception.getMessage(), equalTo("Blob [nested/dir/blob] not found"));
assertThat(exception.getMessage(), containsString("nested/dir/blob] not found"));
}
}
}

0 comments on commit 3f2c3e4

Please sign in to comment.