Skip to content

Commit 2c91ad7

Browse files
committed
Fix to cache mapped port
1 parent 227316d commit 2c91ad7

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

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

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,24 @@ export class AzuriteContainer extends GenericContainer {
9999

100100
const startedContainer = await super.start();
101101

102-
return new StartedAzuriteContainer(
103-
startedContainer,
104-
this.accountName,
105-
this.accountKey,
106-
);
102+
return new StartedAzuriteContainer(startedContainer, this.accountName, this.accountKey);
107103
}
108104
}
109105

110106
export class StartedAzuriteContainer extends AbstractStartedContainer {
107+
private readonly blobPort: number;
108+
private readonly queuePort: number;
109+
private readonly tablePort: number;
110+
111111
constructor(
112112
startedTestContainer: StartedTestContainer,
113113
private readonly accountName: string,
114-
private readonly accountKey: string,
114+
private readonly accountKey: string
115115
) {
116116
super(startedTestContainer);
117+
this.blobPort = this.getMappedPort(BLOB_PORT);
118+
this.queuePort = this.getMappedPort(QUEUE_PORT);
119+
this.tablePort = this.getMappedPort(TABLE_PORT);
117120
}
118121

119122
public getAccountName(): string {
@@ -124,28 +127,28 @@ export class StartedAzuriteContainer extends AbstractStartedContainer {
124127
return this.accountKey;
125128
}
126129

127-
public getMappedBlobPort(): number {
128-
return this.getMappedPort(BLOB_PORT);
130+
public getBlobPort(): number {
131+
return this.blobPort;
129132
}
130133

131-
public getMappedQueuePort(): number {
132-
return this.getMappedPort(QUEUE_PORT);
134+
public getQueuePort(): number {
135+
return this.queuePort;
133136
}
134137

135-
public getMappedTablePort(): number {
136-
return this.getMappedPort(TABLE_PORT);
138+
public getTablePort(): number {
139+
return this.tablePort;
137140
}
138141

139142
public getBlobEndpoint(): string {
140-
return this.getEndpoint(this.getMappedBlobPort(), this.accountName);
143+
return this.getEndpoint(this.blobPort, this.accountName);
141144
}
142145

143146
public getQueueEndpoint(): string {
144-
return this.getEndpoint(this.getMappedQueuePort(), this.accountName);
147+
return this.getEndpoint(this.queuePort, this.accountName);
145148
}
146149

147150
public getTableEndpoint(): string {
148-
return this.getEndpoint(this.getMappedTablePort(), this.accountName);
151+
return this.getEndpoint(this.tablePort, this.accountName);
149152
}
150153

151154
/**

0 commit comments

Comments
 (0)