jeudi 16 janvier 2020

Address already in use in spring boot, can we tell spring to reuse the same address?

I have a set of BDD features which needs to be run on the same port number. The test cases are running in parallel and the test class is annotated with

@ContextConfiguration(classes={c1.class,c2.class})
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class TestFoo
{
   ...
}

I cannot use the RANDOM_PORT setting on the springboottest annotation since I need to run it on the same port always.

Since the tests are running in parallel, it is starting up the context multiple times on the same port number and causing an address already in use exception.

Is it possible to make the application context run only once throughout the execution of all test cases, and make all the tests utilise the same context?

Aucun commentaire:

Enregistrer un commentaire