reactor / reactor/BlockHound

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

Open
#170 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

for/user-attention
Dominant language
Java
Stars
1.5k
Forks
95
Avg merge
1d 14m
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided JUnit test, BlockHound.install(), @EmbeddedKafka, and @DirtiesContext on macOS with JDK 11. Trace the embedded Kafka shutdown after the test completes and verify that Kafka terminates so subsequent tests are no longer blocked.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka, spring-boot
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.