fix: Testcontainer use unique name
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
package com.betriebsratkanzlei.legalconsenthub.config
|
package com.betriebsratkanzlei.legalconsenthub.config
|
||||||
|
|
||||||
import com.github.dockerjava.api.model.ExposedPort
|
|
||||||
import com.github.dockerjava.api.model.HostConfig
|
|
||||||
import com.github.dockerjava.api.model.PortBinding
|
|
||||||
import com.github.dockerjava.api.model.Ports
|
|
||||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection
|
import org.springframework.boot.testcontainers.service.connection.ServiceConnection
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.context.annotation.Bean
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
@@ -21,18 +17,7 @@ class TestContainersConfig {
|
|||||||
.withDatabaseName("legalconsenthub")
|
.withDatabaseName("legalconsenthub")
|
||||||
.withUsername("legalconsenthub")
|
.withUsername("legalconsenthub")
|
||||||
.withPassword("legalconsenthub")
|
.withPassword("legalconsenthub")
|
||||||
.withExposedPorts(5432)
|
|
||||||
.withCreateContainerCmdModifier { cmd ->
|
.withCreateContainerCmdModifier { cmd ->
|
||||||
cmd.withName("legalconsenthub-backend")
|
cmd.withName("legalconsenthub-test-${System.currentTimeMillis()}")
|
||||||
cmd.withHostConfig(
|
|
||||||
HostConfig().apply {
|
|
||||||
this.withPortBindings(
|
|
||||||
PortBinding(
|
|
||||||
Ports.Binding.bindPort(5432),
|
|
||||||
ExposedPort(5432),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}.withReuse(true)
|
}.withReuse(true)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user