-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible incompatibility with Spring context, JUnit5, pact provider async and maven #1265
Comments
I tried to reproduce the issue using a fork from your original pact-maven-amqp-test. I added Spring, but it seems to work properly. Here is mine with only one commit. Do you have an idea how can I get more details from the logs? |
I tried to insert the example from the github repo in the source code of the real application, the behavior is the following: everything works from IDEA, but not from maven. I tought it may be related to some dependency, but I cannot find any difference, here the versions I am using:
Moreover I found this strange behavior: In the first println the mapper is not null, while in the second it is null!
Seems the context is removed. |
Seems the issue is related to the forkCount for the maven plugin (surefire or failsafe). Here is the failing maven build because of the forkCount = 0. You could probably include this requirements in the docs. |
So to understand this issue, when forking is disabled with Maven surefire, the Spring injected values are null during execution of the verification method, but not null during the execution of the before method? I need to investigate what the |
Exaclty, I use two different JVM:
and
|
Looks like the issue is that when
|
The interesting thing is that during the provider state callback, it is correct. They should have similar invocation mechanism, so I would have expected the behavior to be the same. |
The issue is that the I have applied a fix for that. The other option is to not specify the class paths to scan, and it would have used the default class loader. |
4.1.13 released |
Hello, after the upgrade to 4.1.13, it still fails. Here the sample project. |
I recently upgraded all my pact provider tests to
JUnit5
usingau.com.dius.pact.provider:junit5:4.1.11
. For the async ones I am getting this error:Before, using
JUnit4
, they were working with IDEA and with maven.Now, using
JUnit5
, they work only when running with IDEA, but there is no way to have them working with using maven.I am using with failsafe and surefire plugin, I tried with the combination of the following configuration, but the result is always failure.
Here a sample of the code:
As you can see I need the Spring context only for retrieving the actual
ObjectMapper
. I tried using@JsonTest
, that only load theObjectMapper
without the whole application, but I got the same result.Without the Spring context (neither
@SpringBootTest
neither@JsonTest
neither@WebfluxTest
, etc) everything works, except it is not using the actualObjectMapper
.Seems that there is some incompatibility between Spring context, JUnit5, failsafe/surefire and pact jvm provider for async messages. I suppose it is related to the class loader because in IDEA works.
The text was updated successfully, but these errors were encountered: