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
issue6 Timeout tests #267
issue6 Timeout tests #267
Conversation
@@ -344,6 +346,31 @@ public void timeLimit() { | |||
1, lraMetricService.getMetric(LRAMetricType.Compensated, lraId, LraResource.class.getName())); | |||
} | |||
|
|||
/** | |||
* Service A - Timeout 500 ms | |||
* Service B - Type.MANDATORY`` |
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.
* Service B - Type.MANDATORY`` | |
* Service B - Type.MANDATORY |
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
tck/src/main/java/org/eclipse/microprofile/lra/tck/participant/api/LraResource.java
Outdated
Show resolved
Hide resolved
return wae.getResponse(); | ||
} catch (InterruptedException e) { | ||
LOGGER.log(Level.FINE, "Interrupted because time limit elapsed", e); | ||
fail("Interrupted because time limit elapsed"); |
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.
Will this work since this is a JAX-RS resource (i.e. not in the test)
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.
Good question, fail() (at least in junit4 master, today) seems to translate into an exception but I am not sure what a calling side receives if anything?
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.
500 I believe since with exception it's failed JAX-RS invocation.
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 will return a response code instead.
486779b
to
f27d675
Compare
// the next request should fail with a 412 code since the LRA should no longer be active | ||
restPutInvocation(lraId, MANDATORY_LRA_RESOURCE_PATH, ""); | ||
} catch (WebApplicationException wae) { | ||
return wae.getResponse(); |
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.
return wae.getResponse(); | |
return Response.status(wae.getResponse().getStatus()).build(); |
I tested this locally and the response returned in wae
from restPutInvocation
is actually closed in this method [1] which fails the underlying JAX-RS implementation at least in Narayana.
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. I pushed your recommended fix.
f27d675
to
db0ab3a
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.
LGTM
#6
The issue called for 3 different tests. I implemented the first one TckTests#timeLimitWithPreConditionFailed
The second test is very similar to TckTests#timeLimit so I have not added a one for that.
The third test that was asked for was to verify that the time limit is respected after a system crash. But we already have a test for that (see TckRecoveryTests#testCancelWhenParticipantIsUnavailable).