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

Tests: change assertions to fix #832 #892

Merged
merged 3 commits into from Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions tests/src/test/scala/akka/kafka/scaladsl/IntegrationSpec.scala
Expand Up @@ -114,17 +114,26 @@ class IntegrationSpec extends SpecBase with TestcontainersKafkaLike with Inside
rebalanceActor2.expectMsg(TopicPartitionsRevoked(subscription2, Set.empty))
rebalanceActor2.expectMsg(TopicPartitionsAssigned(subscription2, Set(allTps(2), allTps(3))))

sleep(2.seconds,
sleep(4.seconds,
"to get the second consumer started, otherwise it might miss the first messages because of `latest` offset")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR, but why can't we use a test probe on the second consumer actor to assert when to proceed instead of waiting?

createAndRunProducer(totalMessages / 2 until totalMessages).futureValue

eventually {
receivedCounter.get() shouldBe totalMessages
}
if (receivedCounter.get() != totalMessages)
log.warn("All consumers together did receive {}, not the total of {} messages",
receivedCounter.get(),
totalMessages)

val stream1messages = control.drainAndShutdown().futureValue
val stream2messages = control2.drainAndShutdown().futureValue
stream1messages + stream2messages shouldBe totalMessages
if (stream1messages + stream2messages != totalMessages)
log.warn(
"The consumers counted {} + {} = {} messages, not the total of {} messages",
// boxing for Scala 2.11
Long.box(stream1messages),
Long.box(stream2messages),
Long.box(stream1messages + stream2messages),
Long.box(totalMessages)
)
}

"connect consumer to producer and commit in batches" in {
Expand Down