You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importcom.dimafeng.testcontainers.{ForAllTestContainer, KafkaContainer}
importorg.scalatest.flatspec.AnyFlatSpecclassKafkaExampleTestextendsAnyFlatSpecwithForAllTestContainer {
overridedefcontainer:KafkaContainer=KafkaContainer()
"Kafka container" should "be started" in {
container.bootstrapServers
}
}
This code throws
java.lang.IllegalStateException: You should start Kafka container first
at org.testcontainers.containers.KafkaContainer.getBootstrapServers(KafkaContainer.java:89)
at com.dimafeng.testcontainers.KafkaContainer.bootstrapServers(KafkaContainer.scala:25)
at links.kafka.KafkaExampleTest.$anonfun$new$1(KafkaExampleTest.scala:10)
It happens only with ForAllTestContainer trait. When using new TestContainerForAll from experimental API it works as expected. Tested on Ubuntu 18.04 and Docker Toolbox for Windows using testcontainsers-scala v0.38.4, same results.
The text was updated successfully, but these errors were encountered:
Had a similar issue with Postgresql as linked by Mithunatri.
In my case changing override def container = PostgreSQLContainer() by an override val solved the problem (actually the examples use a val but IntelliJ overrides with a def by default).
Minimal test to reproduce the issue:
This code throws
It happens only with
ForAllTestContainer
trait. When using newTestContainerForAll
from experimental API it works as expected. Tested on Ubuntu 18.04 and Docker Toolbox for Windows using testcontainsers-scala v0.38.4, same results.The text was updated successfully, but these errors were encountered: