Dropwizard IT Port Randomisation

2015-03-02 02:45UTC

Dropwizard's testing package includes a @ClassRule, DropwizardAppRule, that may be used to create end-to-end integration tests. However, you may rapidly discover that parallel test execution is severely impaired, as each test attempts to use the same application and admin ports as another. You can get around this by changing your tests' configuration to bind to port 0:

server:
    applicationConnectors:
        - type: http
          port: 0
    adminConnectors:
        - type: http
          port: 0

In Windows and Linux, this will result in both the application and admin connectors using a random, unused port.