Skip to content

Commit f8aee19

Browse files
Configure Azurite custom service ports
1 parent a75cb39 commit f8aee19

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

packages/modules/azurite/src/azurite-container.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ describe("AzuriteContainer", { timeout: 240_000 }, () => {
104104

105105
await using container = await new AzuriteContainer(IMAGE)
106106
.withSkipApiVersionCheck()
107-
.withBlobPort({ container: 10001, host: blobPort })
108-
.withQueuePort({ container: 10002, host: queuePort })
109-
.withTablePort({ container: 10003, host: tablePort })
107+
.withBlobPort({ container: 11000, host: blobPort })
108+
.withQueuePort({ container: 11001, host: queuePort })
109+
.withTablePort({ container: 11002, host: tablePort })
110110
.start();
111111

112112
expect(container.getBlobPort()).toBe(blobPort);
@@ -122,6 +122,14 @@ describe("AzuriteContainer", { timeout: 240_000 }, () => {
122122
const serviceClient = BlobServiceClient.fromConnectionString(connectionString);
123123
const containerClient = serviceClient.getContainerClient("test");
124124
await containerClient.createIfNotExists();
125+
126+
const queueServiceClient = QueueServiceClient.fromConnectionString(connectionString);
127+
await queueServiceClient.createQueue("test-queue");
128+
129+
const tableClient = TableClient.fromConnectionString(connectionString, "testTable", {
130+
allowInsecureConnection: true,
131+
});
132+
await tableClient.createTable();
125133
});
126134

127135
it("should be able to enable HTTPS with PEM certificate and key", async () => {

packages/modules/azurite/src/azurite-container.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,20 @@ export class AzuriteContainer extends GenericContainer {
159159
}
160160

161161
public override async start(): Promise<StartedAzuriteContainer> {
162-
const command = ["--blobHost", "0.0.0.0", "--queueHost", "0.0.0.0", "--tableHost", "0.0.0.0"];
162+
const command = [
163+
"--blobHost",
164+
"0.0.0.0",
165+
"--blobPort",
166+
getContainerPort(this.blobPort).toString(),
167+
"--queueHost",
168+
"0.0.0.0",
169+
"--queuePort",
170+
getContainerPort(this.queuePort).toString(),
171+
"--tableHost",
172+
"0.0.0.0",
173+
"--tablePort",
174+
getContainerPort(this.tablePort).toString(),
175+
];
163176

164177
if (this.oauthEnabled && this.cert === undefined) {
165178
throw new Error("OAuth requires HTTPS endpoint. Configure SSL first with withSsl() or withSslPfx().");

0 commit comments

Comments
 (0)