pact-foundation / pact-php

PHP version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project
Apache License 2.0
274 stars 92 forks source link

Tests get stuck #277

Closed qrtyzmng closed 6 months ago

qrtyzmng commented 2 years ago

We have problem that if you add more than 64 tests in a provider then the tests will never end. We waited 2h but looks like it's get stucked somewhere in amphp/amp exactly here https://github.com/amphp/amp/blob/master/lib/Loop/NativeDriver.php#L300

We are using pact-foundation/pact-php 8.1 and below is our PHP (we are running on PHP 8.1) code what we are using. In docker logs we can see exactly 64 calls to broker.

    $config = new VerifierConfig();
    $config->setProviderName('Our Service')
        ->setProviderVersion($this->pactVersion)
        ->addConsumerVersionTag($this->pactConsumerTag)
        ->setProviderVersionTag($this->pactProviderTag)
        ->setBrokerUri(new Uri($this->pactBrokerUri))
        ->setProviderBaseUrl(new Uri($this->pactProviderBaseUrl))
        ->addCustomProviderHeader(
            'Authorization',
            'Bearer ' . $this->token
        )
        ->setPublishResults($this->pactPublish);

    $verifier = new Verifier($config);
    try {
        $verifier->verifyFromConfig();
    } catch (\Throwable $e) {
        $this->tester->fail('Contracts could not be verified: ' . $e->getMessage());
    }
YOU54F commented 6 months ago

Thanks for raising, and noting this for others.

Please retry with v10.x as this has been rebuilt with the pact-rust core, which should be more performant than our previous ruby core.