-
Notifications
You must be signed in to change notification settings - Fork 195
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
[junit5] Injecting an @ArquillianResource
which depends on the container being started results in the resource not being found
#661
Comments
As part of the 2.0 work I really want to look at switching to a static, deterministic set of lifecycle events and look into issues around how early the arquillian.xml descriptor is parsed. This would mean replacing the EventTestRunnerAdaptor with some ContractTestRunnerAdaptor. We should also look at all of the available Junit5 callbacks to see if there are other we should integrate with as well as how testcontainers integrates. In terms of the current issue, I remember I had to add more information to the contain/protocol metadata to have access to it in one of the test artifact callbacks. We still have this issue(#587) about how the contract between the DeployableContainer and Protocol is not clean, and this is relevant to this issue as well because the issue is about wanting access to the So @jamezp , what does wildfly need to be able to generate the URL for a deployment? What I'm suggesting in the #587 issue is that we have a new method on either the interface ProtocolContainerAdapter {
ProtocolMetaData prepareDeployment(ContainerConfiguration cc, ProtocolConfiguration pc, Archive testArchive);
} and this would be called during the |
I do think that #587 makes sense. In this specific case, it wouldn't work for the issue I'm seeing. I need to look at the JUnit documentation to understand why the callbacks are happening in the order I'm seeing them. Effectively though this is what I see. The The simple fix seemed to be to change where the parameters were set by using the That said, it does seem the |
I've got a fix now which may or may not be correct. I'm going to run the full clustering test suite in WildFly first before I make any more changes. Then I'll see if I can write a test for this. |
For clarification the
That is where we attempt to resolve parameters is in a The simple solution seems to be to use the It's not clear to me how to correctly activate a context or if that is correct. Potentially it could be done in the |
Issue Overview
Given a manual mode test where a
@BeforeEach
or potentially a@BeforeAll
method is responsible for starting the container, method parameters resolved for@ArquillianResource
methods might not be available.The issue seems to be the
TestRunnerAdaptor.before()
is fired in thebeforeEach()
of theArquillianExtension
. However, the test method seems to already be resolved and there is an attempt to lookup the method parameters before the container is started.An example test looks like:
Given the above method the test with throw an exception like:
I need to write a test/reproducer still. I've been able to reproduce it in WildFly and did find a fix for the specific WildFly issue. However, the fix seems to break other cases.
What is likely needed is the
ArquillianExtension
should implement theBeforeTestExecutionCallback
and that's where the parameters should be set for test methods. Observing theBefore
event is likely too soon for test methods, but might be needed for@BeforeEach
methods.The issue I'm currently seeing when implementing the
BeforeTestExecutionCallback
is theURL
is not available in the the active Arquillian contexts. This seems to be resolved from theProtocolMetaData
which is not available in theTestScoped
context. TheProtocolMetaData
is set after a deployment is done as it comes from theDeployableContainer.deploy()
method.This follows up on #312.
The text was updated successfully, but these errors were encountered: