-
Notifications
You must be signed in to change notification settings - Fork 257
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
Mocking doesn't work #629
Comments
@connormullett The example actually works and finishes as expected though it's indeed confusing we're getting bootstrap connection refused failures being logged (that might be a bug on librdkafka). But if you check the code, the consumer actually receives messages and the latency is actually measured.
This sounds like |
This was the issue and it works! Does is make sense here to have a message to check configuration in case of these types of errors? |
mm I need to check but I think the latest does it already. Which version are you using? |
0.35.0 |
Something else seems funny about the Mock consumer, given this diff: git --no-pager diff
diff --git a/examples/mocking.rs b/examples/mocking.rs
index c4a1d1c4..8b967e25 100644
--- a/examples/mocking.rs
+++ b/examples/mocking.rs
@@ -38,7 +38,7 @@ async fn main() {
.send_result(
FutureRecord::to(TOPIC)
.key(&i.to_string())
- .payload("dummy")
+ .payload(&i.to_string())
.timestamp(now()),
)
.unwrap()
@@ -54,6 +54,7 @@ async fn main() {
println!("Warming up for 10s...");
loop {
let message = consumer.recv().await.unwrap();
+ println!("{:?}", message.payload_view::<str>().unwrap());
let then = message.timestamp().to_millis().unwrap();
if start.elapsed() < Duration::from_secs(10) {
// Warming up. The first message I see via the consumer is around ~ If I only send a small handful of events my consumer never finishes the first Plus, I feel like the fact that this example (with my diff) doesn't start by printing |
Ahhh, I finally checked out the mocking code, and saw the unit test inside, which publishes and consumes 1 item and works. The only difference was I guess there's something about Mocking topic creation where Changing to |
We use this library in production and it's been great so far. We noticed that there was a new mocking module and upgraded to help extend test coverage to ensure stability.
I'm getting the error
KafkaError (Client creation error: librdkafka failed to create consumer queue)
which I found sits really close to the C code in the base library. Our mocks look like the following and have used the example inexamples/mocking.rs
for reference.We use the new type pattern on
StreamConsumer
for additional mocking and expectations such as committing. That's whereStreamingConsumer
comes from.Because of the above error, I cloned the repo and attempted to run the example
mocking.rs
locally and failed with the following.Because the example failed, I'm optimistic that this is something on my end but I can't find any documentation surrounding this.
Thanks for looking into this
The text was updated successfully, but these errors were encountered: