You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a provider build that pulls contracts from pactflow. We've enabled all pending test options and see the appropriate lines in the logs. We have one case in the contract that is expected to fail but since it's pending it should not fail the build. Unfortunately it does fail the build and can be replicated locally/consistently.
Below you'll find our standard provider test case and some relevant logs:
@PactBroker
@Provider("ExtractorProvider")
class ExtractorProviderTest {
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider::class)
fun pactVerificationTestTemplate(context: PactVerificationContext) {
context.verifyInteraction()
}
@BeforeEach
fun beforeEach(context: PactVerificationContext) {
context.target = MessageTestTarget(packagesToScan = listOf(this::class.java.packageName))
}
@State("Outputting data")
fun prepOutputData() {
println("TEST ------------")
}
@PactVerifyProvider("Message one")
fun `generate message one output`(): String {
return "{}"
}
@PactVerifyProvider("Message two")
fun `generate message two output`(): String {
return "{}"
}
}
Logs: (Note these logs are here just to illustrate that the pending flag has been enabled but the overall maven build will still fail)
15:57:50.221 [main] INFO a.c.d.p.p.j.PactVerificationStateChangeExtension - Invoking state change method 'Outputting data':SETUP
TEST ------------
Verifying a pact between ClientConsumer (0.9.1-SNAPSHOT-5f778a9) and ExtractorProvider [PENDING]
Notices:
1) The pact at ... is being verified because the pact content belongs to the consumer version matching the following criterion:
* latest version of ClientConsumer from the main branch 'master' (0.9.1-SNAPSHOT-5f778a9)
2) This pact is in pending state for this version of ExtractorProvider because a successful verification result for a version of ExtractorProvider with tag 'testing' has not yet been published. If this verification fails, it will not cause the overall build to fail. Read more at https://docs.pact.io/go/pending
[from Pact Broker ...]
Given Outputting data
Message two
Test Name: ...(AsynchronousMessage)
generates a message which
has a matching body (FAILED)
has matching metadata (OK)
Failures:
1) Message one: generates a message which has a matching body
1.1) body: $ Actual map is missing the following keys: ...
{...}
After a bit of research into the codebase I noticed this line which will be set to ANNOTATED_METHOD when using the MessageTestTarget.
Then the code flows ultimately to here which always sets the pending flag to false. Updating that to consumer.pending seems to resolve our issue when testing locally.
Hope that provides some insight into the issue. Let me know if I can provide any more info.
The text was updated successfully, but these errors were encountered:
We have a provider build that pulls contracts from pactflow. We've enabled all pending test options and see the appropriate lines in the logs. We have one case in the contract that is expected to fail but since it's pending it should not fail the build. Unfortunately it does fail the build and can be replicated locally/consistently.
Below you'll find our standard provider test case and some relevant logs:
Logs: (Note these logs are here just to illustrate that the pending flag has been enabled but the overall maven build will still fail)
After a bit of research into the codebase I noticed this line which will be set to
ANNOTATED_METHOD
when using the MessageTestTarget.Then the code flows ultimately to here which always sets the pending flag to false. Updating that to
consumer.pending
seems to resolve our issue when testing locally.Hope that provides some insight into the issue. Let me know if I can provide any more info.
The text was updated successfully, but these errors were encountered: