Skip to content

KafkaEmbedded without @Rule/after() can cause build failures with System.exit #345

@dgradl

Description

@dgradl

Following the example of using @embeddedkafka with KafkaEmbedded in the documentation worked fine in many situations, but found that when executing on build servers as part of a gradle build my tests would succeed, but the overall build would fail with "Process 'Gradle Test Executor 1' finished with non-zero exit value 1".

This was due to improper shutdown of Zookeeper or Kafka originating from the embedded Kafka. I wasn't able to trace down exactly where it was happening, but I determined that if properly shutdown KafkaEmbedded.after() this would not occur. And this would would also get called if the JUnit Rule were used, which wasn't mentioned in the example from the docs and should look like this.

@Autowired @Rule public KafkaEmbedded kafkaEmbedded;

I don't know if anything more should be done about it, but I would propose to update the example in the documentation, it was rather difficult to isolate the cause.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions