-
Notifications
You must be signed in to change notification settings - Fork 30
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
LRA TCK refactoring while adding Arquillian as integration point for the test #87
LRA TCK refactoring while adding Arquillian as integration point for the test #87
Conversation
bda9ccc
to
b986f0f
Compare
b986f0f
to
b455832
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+100 for adding javadoc explaining test scenarios
tck/running_the_tck.asciidoc
Outdated
time that the tests waits for the coordinator start-up | ||
`lra.tck.coordinator.hostname`:: | ||
hostname where coordinator is available at for TCK suite can run the LRA status from the coordinator | ||
`lra.tck.coordinator.port`:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this and hostname cannot be directly configured by client configuration? e. g. lra.http.url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, it should be possible and it should not be ambiguous as currently is. I will check how is that possible.
tck/running_the_tck.asciidoc
Outdated
|
||
=== MicroProfile Config being available | ||
|
||
The testsuite uses uses configuration while expecting MicroProfile Config is available. The maven coordinates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses uses
tck/running_the_tck.asciidoc
Outdated
|
||
curl -XPUT http://localhost:8080/tck/all?verbose=false | jq | ||
The `arquillian-*.xml` has to define a container that will be starated and managed by Arquillian lifecycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
starated
tck/running_the_tck.asciidoc
Outdated
|
||
=== ResourceProvider of base URL endpoint | ||
|
||
As TCK deployment provides LRA annotated JAX-RS classes which exposes REST endpoints. The TCK suite needs to call them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that dot after "endpoints" seems unintended
tck/running_the_tck.asciidoc
Outdated
|
||
@Override | ||
public Object lookup(ArquillianResource arquillianResource, Annotation... annotations) { | ||
return new URL("http://localhost:8080"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be done also by MP config property? To stay consistent. I guess this is because Arquillian initializes it's injections before CDI does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, this could be done with MP config propery. My intention was that this forces the implementer to really provide the information. Using MP config property is no issue. Originally I have defined it so. I will change it.
} | ||
|
||
/* | ||
* Participants can pass data during enlistment and this data will be returned during | ||
* the complete/compensate callbacks | ||
*/ | ||
// TODO: is this test to be run? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no point in keeping it if it won't be run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaning tests are planned as the next step. I need to discuss the intent with the author.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (readEntity) { | ||
return response.readEntity(String.class); | ||
} | ||
assertEquals("Not expected status at call ' " + resourcePath.getUri() + "'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant space after '
public Activity getActivityAndAssertExistence(String lraId, UriInfo jaxrsContext) { | ||
if(!activities.containsKey(lraId)) { | ||
String errorMessage = String.format("Activity store does not contain LRA id '%s' " | ||
+ "while it was invoked method at '%s'", lraId, jaxrsContext.getPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invoked by the method at?
* attribute update the timeLimit to 300 sleep for 200 return from the method so the LRA will | ||
* have been running for 200 ms so it should not be cancelled | ||
*/ | ||
lraClient.renewTimeLimit(lraToURL(lraId, "Invalid LRA id"), 300, ChronoUnit.MILLIS); | ||
// sleep for 200000 micro seconds (should be longer than specified in the timeLimit annotation attribute) | ||
Thread.sleep(200); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
LOGGER.log(Level.FINE, "Interrupted because the revewed time limit elapsed", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renewed
if(value < 0){ | ||
throw new IllegalArgumentException("value to adjust can't be negative"); | ||
} | ||
return (int) Math.ceil(value * factor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can reuse long variant I think
I see your point and I'm really for adding the javadoc comment to describe what is the purpose of the testcases. Just bear in mind that the current change is meant to re-factor from old http execution style to junit+arquillian. Comments were not part of the codebase before and they are not either for now. I didn't implement the test cases. If I add the comments I need to study the purpose and reason about validity of the test cases. Please, believe me, I can promise I will add javadoc description as the next step. |
f90705e
to
e653b45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking great, I only had a few comments.
Also can you indicate somewhere how to debug the tests (either in the docs or on this PR).
tck/running_the_tck.asciidoc
Outdated
The URL where the TCK suite deployment is exposed at. The TCK suite will construct path based on this URL. | ||
The default base URL is `http://localhost:8180`. | ||
`lra.tck.timeout.factor`:: | ||
Timeout factor of default value `1.0`. When set bigger than `1.0` then timeout value will be bigger and waiting time are longer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean it is a multiplier for the property lra.tck.coordinator.waiting
. If so, why not just let the user tune the value to what is appropriate for his test environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lra.tck.timeout.factor
is used to influence any timeout (any waiting time) in the TCK suite I enhanced the description to be more comprehensible.
I removed the waiting time completely for now. The TCK implementor can handle the waiting time for coordinator startup on his own.
tck/running_the_tck.asciidoc
Outdated
When set-up lower then the timeouts will be shorter. | ||
`lra.tck.coordinator.waiting`:: | ||
Time that the tests waits for the LRA recovery starts-up. | ||
`lra.http.host`, `lra.http.port`:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use an authority strings for endpoints instead (https://tools.ietf.org/html/rfc3986#section-3.2) or maybe just say it is a URI which gives us maximum flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this parameters will be removed completely as discussed at the meeting the coordinator should not be expected by TCKs
tck/running_the_tck.asciidoc
Outdated
To enable the tests in your implementation of this specification you need to add the | ||
following dependency to your build: | ||
* `pom.xml` dependencies are set-up | ||
* MicroProfile Config is providedby runtime for the LRA TCK suite could be run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't read very well. Instead I would just say:
MicroProfile Config
Or:
the LRA TCK suite requires MicroProfile Config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
* a default Arquillian container is configured in `arquillian.xml` (tests manually deploy with use of `@ArquillianResource Deployer`) | ||
* implementation provides one implementation of `org.eclipse.microprofile.lra.client.LRAClient` as it's injected by TCK suite | ||
* implementation has to provide one implementation of `org.eclipse.microprofile.lra.tck.spi.ManagementSPI`. This is an interface | ||
with definition of util methods used by the TCK suite for its run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you will remove this requirement if we end up removing the ManagementSPI interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, correct
*/ | ||
@Inject @ConfigProperty(name = LRAClient.LRA_RECOVERY_PATH_KEY, defaultValue = "lra-recovery-coordinator") | ||
private int recoveryPath; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR #68 is removing all of these properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I see. There will be just lra.http.recovery.url
. When the PR#68 is merged I can change this for url too.
lraClient.close(); | ||
msClient.close(); | ||
rcClient.close(); | ||
if(tckSuiteClient != null) tckSuiteClient.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we use checkstyle in the TCK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the checkstyle is used and it's active. Do you mean that you don't like this without use of curly braces?
if(tckSuiteClient != null) {
tckSuiteClient.close();
}
If you are about to add this rule to the checkstyle I can change the code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that all projects should be using the same set of rules but I see that ours is different since we have commented out NeedBraces:
!--module name="NeedBraces"
I would recommend that that rule is re-enabled.
I will check to see where else we are different from other projects and if we are I will raise a separate issue for it (hopefully this is the only one).
@Test | ||
private String isCompensatedLRA() throws WebApplicationException { | ||
URL lra = lraClient.startLRA(null, "SpecTest#isCompensatedLRA", LRA_TIMEOUT_MILLIS, ChronoUnit.MILLIS); | ||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
yes, the tests marked as @Ignore
are not run in current TCK. Even they were not marked as Ignore they were rejected from running by not being defined in the list of permitted tests.
Are you fine that this step of checking what are purposes of tests will be run as separate follow-up task after this PR will be merged and when SmallRye client implementation is merged to repo (for being possible to run the TCK tests - e.g. those ignored ones - with some existing implementation)?
@Test | ||
private String isCompletedLRA() throws WebApplicationException { | ||
URL lra = lraClient.startLRA(null, "SpecTest#isCompletedLRA", LRA_TIMEOUT_MILLIS, ChronoUnit.MILLIS); | ||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@Test | ||
private String joinLRAViaBody() throws WebApplicationException { | ||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
/* | ||
* Participants can pass data during enlistment and this data will be returned during | ||
* the complete/compensate callbacks | ||
*/ | ||
// TODO: is this test to be run? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
72f5d45
to
548616b
Compare
Thanks. I fixed the point you have. I would like to remove the ManagementSPI in the next step when each test case should be examined. There will be point to add all of them under issue #92.
I added a short section on debugging but the way depends on the runtime where the TCK suite is deployed. |
548616b
to
cad5d01
Compare
@ochaloup Have you tried testing the new TCK against any LRA implementations yet? |
@mmusgrov as mentioned in the description I was working with Narayana implementation https://github.com/ochaloup/narayana/tree/lra-tck-arquillian-rework. But I think it does not follow all the changes happened during last week (or two). The LRA client branch needs changes to be aligned and working. |
Can we control which snapshot build get's pulled in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only remaining issue was if you could uncomment the rule module name="NeedBraces"
If other stuff breaks as a result of this and you don't want to fix them then just ignore this comment and I wil raise a separate issue.
@mmusgrov for Narayana I don't know other way then define the snapshot in pom.xml. Or we can be creating some tags in this repo and get those particular ones built in CI. |
…o be on separate line Signed-off-by: Ondra Chaloupka <[email protected]>
… being passed as null Signed-off-by: Ondra Chaloupka <[email protected]>
cad5d01
to
62a3cb6
Compare
@mmusgrov I updated the checkstyle as you mentioned and fixed the merge trouble caused by the changes in spec |
Does the TCK run with implementation and coordinator? It should not be all green and use our latest decisions, but we need to make sure that it runs. Finetuning (on the tck side and the implementation) can be done afterward. |
Signed-off-by: Ondra Chaloupka <[email protected]> Applying changes based on issue59
62a3cb6
to
7172f13
Compare
I just fixed typos that was mentioned by @xstefank in his comments and I forgot to address them. Otherwise no other changes with this force push. |
@rdebusscher the idea is that the implementator of the TCK will ensure:
So the Narayana TCK runner is about to start the Narayana LRA coordinator and to configure Arquillian to be capable to deploy tests. Is that what you meant? |
Yes and no :) We just need to make sure this updated code actually run with 'something' already (since the TCK is part of something bigger and cannot run on his own. You need those 3 points you mentioned) I did assume that already. That is why I approved this PR. |
fixes #94
Refactoring of the TCK tests which provides Arquillian to base the integration on.
This adds Arquillian handling, changing few names and adding MicroProfile Config to the play.
When agreed on this approach and this is about to be merged I would like to continue with some more refactoring of the TCK codebase. There are still some comments and tests which needs to be clarified. This mostly migrates tests to be run with Arquillian but it does not do any changes in the logic of the tests.
The concept of the Arquillian integration is based on other spec (https://github.com/eclipse/microprofile-fault-tolerance/blob/master/tck/running_the_tck.asciidoc, https://github.com/eclipse/microprofile-health/blob/master/tck/running_the_tck.asciidoc).
The changes for Narayana LRA client are at: https://github.com/ochaloup/narayana/tree/lra-tck-arquillian-rework
As MicroProfile Config is used the timeout is configurable with changes provided here. The #60 are about to be covered by this PR.
Can you please take a look how you feel about this?: @mmusgrov @rdebusscher @xstefank