【发布时间】: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