【问题标题】:Spring Kafka test with embedded Kafka failed on deleting logs带有嵌入式 Kafka 的 Spring Kafka 测试在删除日志时失败
【发布时间】:2019-08-23 08:38:25
【问题描述】:

我正在使用带有嵌入式 kafka 的 spring kafka 进行 JUnit 测试,它在 windows 上的每个测试都会出错:

Error deleting C:\Users:LXX691\AppData\Local\Temp\kafka-1103610162480947200/.lock: The process cannot access the file because it is being used by another process.

我只是做了如下的基本配置

@SpringBootTest(webEnvironment = RANDOM_PORT)
@RunWith(SpringRunner.class)
public class KafkaTest {
  @Autowired
  EmbeddedKafkaBroker broker;

  @Before
  void setUp() throws Exception() {
    // setup producer and consumers
  }

  @Test
  void test() {
    producer.send(new ProducerRecord<>("topic", "content"));
  }
}

感谢任何解决建议或解决方法。

【问题讨论】:

  • 是否有任何解决方法可以使测试通过,因为这是我们无法处理的已知问题?
  • 我不认为它会使测试失败。

标签: apache-kafka spring-kafka spring-kafka-test


【解决方案1】:

这是 Apache Kafka 中的一个已知问题:https://issues.apache.org/jira/browse/KAFKA-8145

不幸的是,在 Spring Kafka 中我们无能为力。

在此处查看更多信息:Kafka: unable to start Kafka - process can not access file 00000000000000000000.timeindex 和此处https://github.com/spring-projects/spring-kafka/issues/194

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 2016-12-03
    • 2022-06-15
    • 2018-07-23
    • 1970-01-01
    • 2019-11-11
    • 1970-01-01
    相关资源
    最近更新 更多