Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use external Kafka in tests #775

Merged
merged 5 commits into from Apr 30, 2019

Conversation

Projects
None yet
2 participants
@ennru
Copy link
Member

commented Apr 24, 2019

Purpose

Use external Kafka in Docker started and stopped by Testcontainers to run tests with.

References

Preparation for #540

Background Context

I don't expect Apache Kafka to use Scala 2.13 very soon, to run our tests with Scala 2.13 the Kafka instance cannot be in the same JVM.

@ennru ennru marked this pull request as ready for review Apr 29, 2019

@ennru ennru force-pushed the ennru:docker-kafka-instead-of-embedded branch from 0987e5a to 13fb99f Apr 29, 2019

@ennru

This comment has been minimized.

Copy link
Member Author

commented Apr 29, 2019

Failing tests are related to the transactions work.

@@ -37,7 +37,8 @@ import scala.util.{Failure, Success, Try}
trait EmbeddedKafkaLike extends KafkaSpec {

lazy implicit val embeddedKafkaConfig: EmbeddedKafkaConfig = createKafkaConfig
def createKafkaConfig: EmbeddedKafkaConfig

def createKafkaConfig: EmbeddedKafkaConfig = EmbeddedKafkaConfig(kafkaPort, zooKeeperPort)

This comment has been minimized.

Copy link
@ennru

ennru Apr 30, 2019

Author Member

I don't know why we didn't have a default config here before.

@@ -16,25 +16,24 @@ object KafkaPorts {
val TransactionsSpec = 9022
val ReconnectSpec = 9032
val ReconnectSpecProxy = 9034
val TimestampSpec = 9042
// val _ = 9042

This comment has been minimized.

Copy link
@ennru

ennru Apr 30, 2019

Author Member

I kept those for re-use.

@@ -280,7 +267,7 @@ class IntegrationSpec extends SpecBase(kafkaPort = KafkaPorts.IntegrationSpec) w
// GetEndOffsets
inside(Await.result(consumer ? GetEndOffsets(Set(partition0)), remainingOrDefault)) {
case EndOffsets(Success(offsets)) =>
assert(offsets == Map(partition0 -> 101), "Wrong EndOffsets for topic")
assert(offsets == Map(partition0 -> 100), "Wrong EndOffsets for topic")

This comment has been minimized.

Copy link
@ennru

ennru Apr 30, 2019

Author Member

This initial message is not there anymore.

@ennru ennru added this to the 1.0.2 milestone Apr 30, 2019

scope=test
}

By mixin in `EmbeddedKafkaLike` an embedded Kafka instance will be started before the tests in this test class execute shut down after all tests in this test class are finished.

This comment has been minimized.

Copy link
@2m

2m Apr 30, 2019

Member
Suggested change
By mixin in `EmbeddedKafkaLike` an embedded Kafka instance will be started before the tests in this test class execute shut down after all tests in this test class are finished.
By mixing in `EmbeddedKafkaLike` an embedded Kafka instance will be started before the tests in this test class execute shut down after all tests in this test class are finished.
scope=test
}

By mixin in `TestcontainersKafkaLike` the Kafka Docker container will be started before the first test and shut down after all tests are finished.

This comment has been minimized.

Copy link
@2m

2m Apr 30, 2019

Member
Suggested change
By mixin in `TestcontainersKafkaLike` the Kafka Docker container will be started before the first test and shut down after all tests are finished.
By mixing in `TestcontainersKafkaLike` the Kafka Docker container will be started before the first test and shut down after all tests are finished.
@2m

2m approved these changes Apr 30, 2019

Copy link
Member

left a comment

LGTM. I like that tracking ports is not required anymore when using test containers

@ennru ennru merged commit 68959c8 into akka:master Apr 30, 2019

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
typesafe-cla-validator All users have signed the CLA
Details

@ennru ennru deleted the ennru:docker-kafka-instead-of-embedded branch Apr 30, 2019

charlibot added a commit to charlibot/alpakka-kafka that referenced this pull request May 10, 2019

Use external Kafka in tests (akka#775)
* Testcontainers support in testkit to start/stop Kafka in Docker

charlibot added a commit to charlibot/alpakka-kafka that referenced this pull request May 10, 2019

Use external Kafka in tests (akka#775)
* Testcontainers support in testkit to start/stop Kafka in Docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.