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_r161516481
##########
File path:
omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/LoadBalancedClusterMessageSenderTest.java
##########
@@ -293,6 +295,28 @@ public void stopSendingWhenClusterIsDown() throws
Exception {
await().atMost(2, SECONDS).until(() -> eventsMap.get(8080).size() == 1 ||
eventsMap.get(8090).size() == 1);
}
+ @Test
+ public void forwardSendResult() {
+ assertThat(messageSender.send(event).aborted(), is(false));
+
+ TxEvent rejectEvent = new TxStartedEvent(globalTxId, localTxId,
parentTxId, "reject", "blah");
+ assertThat(messageSender.send(rejectEvent).aborted(), is(true));
+ }
+
+ @Test
+ public void blowsUpWhenServerIsInterrupted() {
+ Thread thread = new Thread(() -> {
+ try {
+ messageSender.send(event);
+ expectFailing(OmegaException.class);
+ } catch (OmegaException e) {
+ assertThat(e.getMessage().endsWith("interruption"), is(true));
+ }
+ });
+ thread.start();
+ thread.interrupt();
Review comment:
need to join here to wait for thread exit
----------------------------------------------------------------
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