Skip to content

When Blockhound is used with EmbeddedKafka for unit test, kafka wont terminate #170

@legendjaks

Description

@legendjaks

When Blockhound is used with EmbeddedKafka for unit test, Kafka won't terminate after the test is completed. If Blockhound is disabled, no problem in running tests.

Expected Behavior

After tests are completed, embedded Kafka should be terminated.

Actual Behavior

After tests are completed, embedded Kafka is not terminated. So other tests are not running and the system is waiting for Kafka to stop.

Steps to Reproduce

@SpringBootTest(classes = {KafkaConfiguration.class})
@EmbeddedKafka(partitions = 1, brokerProperties = {TestConstants.SERVER, TestConstants.PORT})
@DirtiesContext
@Slf4j
class OrderUpdateTest {

  @BeforeEach
  public void init() {
    BlockHound.install();
    log.info("Installed blockhound");
  }

  @Test
  public void testProducer()
    throws Exception {
     log.info("test");
  }

  @AfterEach
  public void after() {
    log.info("finished test");
  }
}

Your Environment

  • OS: macOS Big Sur
  • Java:JDK11
  • Spring Boot 2.4.2
  • Blockhound 1.0.4.RELEASE
  • Spring Kafka 2.5.6.RELEASE

Metadata

Metadata

Assignees

No one assigned

    Labels

    for/user-attentionThis issue needs user attention (feedback, rework, etc...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions