11import { ServiceBusClient } from "@azure/service-bus" ;
22import { GenericContainer , Wait } from "testcontainers" ;
33import { 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 ( / .* R e c o v e r y i s c o m p l e t e .* / , 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 ( ) ;
0 commit comments