This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git

commit d13b58155996eca201c6f94be6c3241209d37e51
Author: Willem Jiang <jiangni...@huawei.com>
AuthorDate: Thu Aug 9 12:41:07 2018 +0800

    Try to fix the test error of AlphaIntegrationTest
---
 .../servicecomb/saga/alpha/server/AlphaIntegrationTest.java      | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
 
b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
index 71e572d..66e035b 100644
--- 
a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
+++ 
b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
@@ -434,8 +434,13 @@ public class AlphaIntegrationTest {
     assertThat(events.get(0).type(), is(SagaStartedEvent.name()));
     assertThat(events.get(1).type(), is(TxStartedEvent.name()));
     assertThat(events.get(2).type(), is(TxAbortedEvent.name()));
-    assertThat(events.get(3).type(), is(TxCompensatedEvent.name()));
-    assertThat(events.get(4).type(), is(SagaEndedEvent.name()));
+    // The SagaEndedEvent could be received before TxCompensatedEvent
+    if ("TxCompensatedEvent".equals(events.get(3).type())) {
+      assertThat(events.get(4).type(), is(SagaEndedEvent.name()));
+    } else {
+      assertThat(events.get(3).type(), is(SagaEndedEvent.name()));
+      assertThat(events.get(4).type(), is(TxCompensatedEvent.name()));
+    }
 
     await().atMost(2, SECONDS).until(this::waitTillTimeoutDone);
 

Reply via email to