Skip to content

Commit d3654fe

Browse files
Minor improvements/fixes
1 parent b54a6dd commit d3654fe

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

docs/modules/azureservicebus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Azure Service Bus Emulator
1+
# Azure Service Bus
22

33
## Install
44

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
FROM mcr.microsoft.com/azure-messaging/servicebus-emulator:1.1.2
2+
FROM mcr.microsoft.com/mssql/server:2022-latest

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { ServiceBusClient } from "@azure/service-bus";
22
import { GenericContainer, Wait } from "testcontainers";
33
import { getImage } from "../../../testcontainers/src/utils/test-helper";
4-
import { ServiceBusContainer } from "./azureservicebus-container";
4+
import { AzureServiceBusContainer } from "./azureservicebus-container";
55

6-
const IMAGE = getImage(__dirname);
6+
const IMAGE = getImage(__dirname, 0);
7+
const MSSQL_IMAGE = getImage(__dirname, 1);
78

8-
describe("Azure Service Bus", { timeout: 180_000 }, () => {
9+
describe("AzureServiceBusContainer", { timeout: 180_000 }, () => {
910
it("should connect and queue a message", async () => {
1011
// serviceBusConnect {
11-
await using container = await new ServiceBusContainer(IMAGE).acceptLicense().start();
12+
await using container = await new AzureServiceBusContainer(IMAGE).acceptLicense().start();
1213

1314
const client = new ServiceBusClient(container.getConnectionString());
1415
const sender = client.createSender("queue.1");
@@ -59,7 +60,7 @@ describe("Azure Service Bus", { timeout: 180_000 }, () => {
5960
},
6061
});
6162

62-
await using container = await new ServiceBusContainer(IMAGE).acceptLicense().withConfig(config).start();
63+
await using container = await new AzureServiceBusContainer(IMAGE).acceptLicense().withConfig(config).start();
6364

6465
const client = new ServiceBusClient(container.getConnectionString());
6566
const sender = client.createSender(queueName);
@@ -84,15 +85,15 @@ describe("Azure Service Bus", { timeout: 180_000 }, () => {
8485
const customPassword = "MyC0mplexP@ssw0rd!";
8586

8687
// @testcontainers/mssqlserver can be used as well
87-
const mssqlContainer = new GenericContainer("mcr.microsoft.com/mssql/server:2022-latest")
88+
const mssqlContainer = new GenericContainer(MSSQL_IMAGE)
8889
.withEnvironment({
8990
ACCEPT_EULA: "Y",
9091
MSSQL_SA_PASSWORD: customPassword,
9192
})
9293
.withNetworkAliases("your-network-alias")
9394
.withWaitStrategy(Wait.forLogMessage(/.*Recovery is complete.*/, 1).withStartupTimeout(120_000));
9495

95-
await using container = await new ServiceBusContainer(IMAGE)
96+
await using container = await new AzureServiceBusContainer(IMAGE)
9697
.acceptLicense()
9798
.withMssqlContainer(mssqlContainer)
9899
.withMssqlPassword(customPassword)
@@ -116,7 +117,7 @@ describe("Azure Service Bus", { timeout: 180_000 }, () => {
116117
});
117118

118119
it("should connect containers to the same network", async () => {
119-
await using serviceBusContainer = await new ServiceBusContainer(IMAGE).acceptLicense().start();
120+
await using serviceBusContainer = await new AzureServiceBusContainer(IMAGE).acceptLicense().start();
120121

121122
const servicebusNetworks = serviceBusContainer.getNetworkNames();
122123
const mssqlNetworks = serviceBusContainer.getMssqlContainer().getNetworkNames();

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const DEFAULT_MSSQL_IMAGE = "mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.
1717
const DEFAULT_MSSQL_PASSWORD = "P@ssword1!d3adb33f#";
1818
const CONTAINER_CONFIG_FILE = "/ServiceBus_Emulator/ConfigFiles/Config.json";
1919

20-
export class ServiceBusContainer extends GenericContainer {
20+
export class AzureServiceBusContainer extends GenericContainer {
2121
private acceptEula: string = "N";
2222
private mssqlContainer: GenericContainer | undefined;
2323
private mssqlImage: string = DEFAULT_MSSQL_IMAGE;
@@ -73,7 +73,7 @@ export class ServiceBusContainer extends GenericContainer {
7373
return this;
7474
}
7575

76-
public override async start(): Promise<StartedServiceBusContainer> {
76+
public override async start(): Promise<StartedAzureServiceBusContainer> {
7777
const network = await new Network().start();
7878
this.withNetwork(network);
7979

@@ -110,7 +110,7 @@ export class ServiceBusContainer extends GenericContainer {
110110
try {
111111
const serviceBus = await super.start();
112112

113-
return new StartedServiceBusContainer(serviceBus, mssql, network);
113+
return new StartedAzureServiceBusContainer(serviceBus, mssql, network);
114114
} catch (err) {
115115
await mssql.stop();
116116
await network.stop();
@@ -120,7 +120,7 @@ export class ServiceBusContainer extends GenericContainer {
120120
}
121121
}
122122

123-
export class StartedServiceBusContainer extends AbstractStartedContainer {
123+
export class StartedAzureServiceBusContainer extends AbstractStartedContainer {
124124
constructor(
125125
startedTestContainer: StartedTestContainer,
126126
private readonly mssql: StartedTestContainer,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { AzureServiceBusContainer, StartedAzureServiceBusContainer } from "./azureservicebus-container";

0 commit comments

Comments
 (0)