Lei Zhang created SCB-1152:
------------------------------

             Summary: About abortTimeoutTxStartedEvent test case failed
                 Key: SCB-1152
                 URL: https://issues.apache.org/jira/browse/SCB-1152
             Project: Apache ServiceComb
          Issue Type: Test
          Components: Saga
    Affects Versions: saga-0.4.0
            Reporter: Lei Zhang
            Assignee: Lei Zhang
             Fix For: saga-0.4.0


```
 await().atMost(2, SECONDS).until(() -> {
 List<TxEvent> events = eventRepo.findByGlobalTxId(globalTxId);
 return eventRepo.count() == 5 && events.get(events.size() - 
1).type().equals(SagaEndedEvent.name());
 });
```

Sometimes although eventRepo.count()==5 but there events list of results as 
follows

```
SagaStartedEvent
TxStartedEvent
TxAbortedEvent
SagaEndedEvent
SagaEndedEvent
```

compensation has not yet executed a cycle (method 
deleteDuplicateSagaEndedEvents() has not been executed yet), TxCompensatedEvent 
has not been added yet, but the condition eventRepo.count()==5 is met, so I 
suggest changing to the following

```
 await().atMost(2, SECONDS).until(() -> {
 List<TxEvent> events = eventRepo.findByGlobalTxId(globalTxId);
 return eventRepo.count() == 5 && events.get(events.size() - 
1).type().equals(SagaEndedEvent.name()) && !events.get(events.size() - 
2).type().equals(SagaEndedEvent.name());
 });
```



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to