seanyinx commented on a change in pull request #114: SCB-227 stop sub tx from
running when global tx failed
URL:
https://github.com/apache/incubator-servicecomb-saga/pull/114#discussion_r161444136
##########
File path:
omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspectTest.java
##########
@@ -159,6 +165,24 @@ public void sendsAbortEventOnTimeout() throws Throwable {
assertThat(messages.size(), is(2));
}
+ @Test
+ public void returnImmediatelyWhenReceivedRejectResponse() {
+ MessageSender sender = mock(MessageSender.class);
+ when(sender.send(any())).thenReturn(new AlphaResponse(true));
+
+ TransactionAspect aspect = new TransactionAspect(sender, omegaContext);
+ try {
+ aspect.advise(joinPoint, compensable);
+ expectFailing(OmegaTxAbortedException.class);
+ } catch (OmegaTxAbortedException e) {
+ assertThat(e.getMessage().contains("Abort local sub transaction"),
is(true));
+ } catch (Throwable throwable) {
+ expectFailing(OmegaTxAbortedException.class);
Review comment:
this is not necessary, since test will fail on uncaught exception
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services