Reputation: 7058
I'm trying to access the H2-Console during a WebIntegrationTest in debug mode. However, I noticed that Spring Boot is blocking the H2-console when I'm debugging the test. It seems as soon as a breakpoint is reached, the H2-console is blocked as well. I'm working with Spring Boot 1.3.1.RELEASE.
Each breakpoint in the following test causes to block the H2-console. In breakpoint 1, the login page appears. I then press to login button but nothing happens until I let continue the test to the next breakpoint. In breakpoint 2, I'm logged in and can execute a query. But only when I'm going to the next breakpoint, the query results appear.
@Test
public void whenGetById_thenCorrectId() throws InterruptedException {
// do some stuff
// breakpoint 1
Thread.sleep(1000);
// breakpoint 2
Thread.sleep(1000);
// breakpoint 3
}
The WebIntegrationTest ist configured as follows:
@ActiveProfiles("local,unittest")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyApplication.class)
@WebIntegrationTest({"spring.h2.console.enabled=true", "server.port=8080"})
public class MyResourceTest {
How can I decouple the H2-in-memory DB from the debug mode?
Upvotes: 19
Views: 4906
Reputation: 7058
Breakpoint can be configured to suspend the whole VM or only a single thread. In IntelliJ you can set this via right-click on the respective breakpoint. My breakpoints were configured to suspend the whole VM and so each breakpoint also blocked to access the H2-Console.
Upvotes: 38