1

I am generating a rather large pact file. A parameterized test appends a single interaction to the pact file for every line in a csv document.

Unfortunately, the mockserver created with the @Rule PactProviderRuleMk2 locks up after 200 tests when it hits the connection limit. Apparently, connections are not torn down. For less than two hundred test cases, the system works perfectly.

Is there any way to increase the connection limit for the mockserver, reduce the number of connections or close the connections?


@RunWith(Parameterized.class)
public class PactGenerator {

    private static final Map<String, Testfall> TESTCASES = readTestfallFile();

    @Rule
    public PactProviderRuleMk2 mockProvider  = new PactProviderRuleMk2(PROVIDER, this);

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        // populates TESTCASES
    }

    @Parameterized.Parameter
    public String key;

    @Pact(consumer = CONSUMER)
    public RequestResponsePact pact(PactDslWithProvider builder) {
        return createPact(builder, key);
    }

    @Test
    @PactVerification(value = PROVIDER)
    public void test() throws IOException {
        runTests(key);
    }
}
J_A_X
  • 12,857
  • 1
  • 25
  • 31
Mike Adler
  • 1,199
  • 9
  • 24
  • Hm, are you creating a new mock for every test and not tearing it down? You can either create a new one for every test, then remove it, or use a single one that gets cleared between tests. Can you please provide a better example to run locally as your example is missing some key functions. – J_A_X Dec 21 '17 at 00:23

0 Answers0