Skip to content

Commit

Permalink
Merge pull request #509 from Aiven-Open/ivanyu/azurite-no-https
Browse files Browse the repository at this point in the history
Remove HTTPS from Azure tests
  • Loading branch information
AnatolyPopov authored Mar 12, 2024
2 parents 97d28fb + a35cded commit 6e5550c
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ public class AzureBlobStorageMetricsTest {

@BeforeAll
static void setUpClass() {
// Generally setting JVM-wide trust store needed only for one test may be not OK,
// but it's not conflicting with any other test now and this is the most straightforward way
// to make the self-signed certificate work.
System.setProperty("javax.net.ssl.trustStore",
AzureBlobStorageMetricsTest.class.getResource("/azurite-cacerts.jks").getPath());
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
blobServiceClient = new BlobServiceClientBuilder()
.connectionString(connectionString(AZURITE_SERVER, BLOB_STORAGE_PORT))
.buildClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ abstract class AzureBlobStorageTest extends BaseStorageTest {

@BeforeAll
static void setUpClass() {
// Generally setting JVM-wide trust store needed only for one test may be not OK,
// but it's not conflicting with any other test now and this is the most straightforward way
// to make the self-signed certificate work.
System.setProperty("javax.net.ssl.trustStore",
AzureBlobStorageTest.class.getResource("/azurite-cacerts.jks").getPath());
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
blobServiceClient = new BlobServiceClientBuilder()
.connectionString(connectionString(AZURITE_SERVER, BLOB_STORAGE_PORT))
.buildClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,23 @@

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

public class AzuriteBlobStorageUtils {
static GenericContainer<?> azuriteContainer(final int port) {
return
new GenericContainer<>(DockerImageName.parse("mcr.microsoft.com/azure-storage/azurite"))
.withCopyFileToContainer(
MountableFile.forClasspathResource("/azurite-cert.pem"),
"/opt/azurite/azurite-cert.pem")
.withCopyFileToContainer(
MountableFile.forClasspathResource("/azurite-key.pem"),
"/opt/azurite/azurite-key.pem")
.withExposedPorts(port)
.withCommand("azurite-blob --blobHost 0.0.0.0 "
+ "--cert /opt/azurite/azurite-cert.pem --key /opt/azurite/azurite-key.pem");
.withCommand("azurite-blob --blobHost 0.0.0.0");
}


static String endpoint(final GenericContainer<?> azuriteContainer, final int port) {
return "https://127.0.0.1:" + azuriteContainer.getMappedPort(port) + "/devstoreaccount1";
return "http://127.0.0.1:" + azuriteContainer.getMappedPort(port) + "/devstoreaccount1";
}

static String connectionString(final GenericContainer<?> azuriteContainer, final int port) {
// The well-known Azurite connection string.
return "DefaultEndpointsProtocol=https;"
return "DefaultEndpointsProtocol=http;"
+ "AccountName=devstoreaccount1;"
+ "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;"
+ "BlobEndpoint=" + endpoint(azuriteContainer, port) + ";";
Expand Down
Binary file not shown.
22 changes: 0 additions & 22 deletions storage/azure/src/integration-test/resources/azurite-cert.pem

This file was deleted.

28 changes: 0 additions & 28 deletions storage/azure/src/integration-test/resources/azurite-key.pem

This file was deleted.

0 comments on commit 6e5550c

Please sign in to comment.