File tree Expand file tree Collapse file tree
testcontainers/src/generic-container Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ export class CouchbaseContainer extends GenericContainer {
118118 if ( this . enabledServices . has ( CouchbaseService . EVENTING ) ) {
119119 exposedPorts . push ( PORTS . EVENTING_PORT , PORTS . EVENTING_SSL_PORT ) ;
120120 }
121- return exposedPorts ;
121+ return exposedPorts . filter ( ( port ) => ! this . hasExposedPort ( port ) ) ;
122122 }
123123
124124 private constructWaitStrategies ( ) {
@@ -572,8 +572,7 @@ export class CouchbaseContainer extends GenericContainer {
572572 }
573573
574574 public override async start ( ) : Promise < StartedCouchbaseContainer > {
575- const exposedPorts = this . createOpts . ExposedPorts ?? { } ;
576- this . withExposedPorts ( ...this . getPortsToExpose ( ) . filter ( ( port ) => exposedPorts [ `${ port } /tcp` ] === undefined ) ) ;
575+ this . withExposedPorts ( ...this . getPortsToExpose ( ) ) ;
577576 return new StartedCouchbaseContainer ( await super . start ( ) , this . username , this . password ) ;
578577 }
579578}
Original file line number Diff line number Diff line change @@ -425,6 +425,13 @@ export class GenericContainer implements TestContainer {
425425 return this ;
426426 }
427427
428+ protected hasExposedPort ( port : PortWithOptionalBinding ) : boolean {
429+ const containerPort = getContainerPort ( port ) ;
430+ const protocol = getProtocol ( port ) ;
431+
432+ return Object . hasOwn ( this . createOpts . ExposedPorts ?? { } , `${ containerPort } /${ protocol } ` ) ;
433+ }
434+
428435 public withBindMounts ( bindMounts : BindMount [ ] ) : this {
429436 this . hostConfig . Binds = bindMounts
430437 . map ( ( bindMount ) => ( { mode : "rw" , ...bindMount } ) )
You can’t perform that action at this time.
0 commit comments