Skip to content

Conversation

@Watson1978
Copy link
Contributor

Seems test_in_kafka_group.rb has flaky test, it causes following error sometimes.

$ ruby -I"lib:lib:test" test/plugin/test_in_kafka_group.rb
Loaded suite test/plugin/test_in_kafka_group
Started
E
=========================================================================================================================================================================================================================================================
Error: test_consume(KafkaGroupInputTest::ConsumeTest): NoMethodError: undefined method `[]' for nil
test/plugin/test_in_kafka_group.rb:66:in `test_consume'
     63:         @producer.deliver_messages
     64:       end
     65:       expected = {'message'  => 'Hello, fluent-plugin-kafka!'}
  => 66:       assert_equal expected, d.events[0][2]
     67:     end
     68:   end
     69: end
=========================================================================================================================================================================================================================================================
Finished in 11.063212384 seconds.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 tests, 4 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
66.6667% passed
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0.27 tests/s, 0.36 assertions/s

The topic used for testing is automatically created by the message produce with following code.

@producer.produce("Hello, fluent-plugin-kafka!", topic: TOPIC_NAME)
@producer.deliver_messages

Depending on when it subscribe a topic, it may not have been generated yet, and it seems it cannot consume messages properly.

Therefore, this PR will create the topic in advance and insert a delay to adjust the timing.

@Watson1978 Watson1978 requested a review from daipom October 21, 2025 08:12
Copy link
Contributor

@daipom daipom left a comment

Choose a reason for hiding this comment

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

Thanks!

@daipom daipom merged commit 50e3d17 into fluent:master Oct 21, 2025
23 checks passed
@Watson1978 Watson1978 deleted the flaky-test branch October 21, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants