You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/08/30 02:04:24 UTC

[GitHub] Chenhaoqing opened a new issue #281: When TxEndedEvent comes after TxAbortedEvent, it would not be compensated?

Chenhaoqing opened a new issue #281: When TxEndedEvent comes after TxAbortedEvent, it would not be compensated?
URL: https://github.com/apache/incubator-servicecomb-saga/issues/281
 
 
   I write a test in AlphaIntegrationTest like this,
   ```Java
     @Test
     public void compensateTxEndedEventAfterOtherTxAborted() {
       String sagaGlobalId = UUID.randomUUID().toString();
       String bookingApplicationLocalId = UUID.randomUUID().toString();
       String carServiceLocalId = UUID.randomUUID().toString();
       String hotelServiceLocalId = UUID.randomUUID().toString();
   
       asyncStub.onConnected(serviceConfig, compensateResponseObserver);
   
       blockingStub
               .onTxEvent(someGrpcEvent(SagaStartedEvent, sagaGlobalId, bookingApplicationLocalId));
   
       blockingStub.onTxEvent(someGrpcEvent(TxStartedEvent, sagaGlobalId, carServiceLocalId));
       blockingStub.onTxEvent(someGrpcEvent(TxAbortedEvent, sagaGlobalId, carServiceLocalId));
   
       blockingStub.onTxEvent(someGrpcEvent(TxStartedEvent, sagaGlobalId, hotelServiceLocalId));
       blockingStub.onTxEvent(someGrpcEvent(TxEndedEvent, sagaGlobalId, hotelServiceLocalId));
   
       await().atMost(30, SECONDS).until(() -> receivedCommands.size() > 0); //fail here
       assertThat(receivedCommands.size(), is(1));
   
       GrpcCompensateCommand command = receivedCommands.poll();
       assertThat(command.getGlobalTxId(), is(sagaGlobalId));
       assertThat(command.getLocalTxId(), is(hotelServiceLocalId));
       assertThat(command.getParentTxId(), is(parentTxId));
       assertThat(command.getCompensationMethod(), is(compensationMethod));
       assertThat(command.getPayloads().toByteArray(), is(payload.getBytes()));
     }
   
   ```
   
   is it a valid testcase?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services