Skip to content

Commit

Permalink
Merge 3d55393 into 5682839
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbeevip committed Mar 3, 2021
2 parents 5682839 + 3d55393 commit 10558e5
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.apache.servicecomb.pack.omega.transaction;

import static com.seanyinx.github.unit.scaffolding.AssertUtils.expectFailing;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.core.Is.is;
Expand All @@ -32,9 +34,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import java.util.concurrent.Callable;
import javax.transaction.InvalidTransactionException;

import org.apache.servicecomb.pack.common.EventType;
import org.apache.servicecomb.pack.contract.grpc.ServerMeta;
import org.apache.servicecomb.pack.omega.context.IdGenerator;
Expand Down Expand Up @@ -155,12 +156,16 @@ public void throwExceptionWhenRetryReachesMaximum() throws Throwable {
containsString("Failed to handle tx because it is interrupted")));
}

assertThat(messages.size(), is(3));
await().atMost(10, SECONDS).until(new Callable() {
@Override
public Boolean call() {
return messages.size() == 3;
}
});
assertThat(messages.get(0).type(), is(EventType.TxStartedEvent));
assertThat(messages.get(1).type(), is(EventType.TxStartedEvent));
assertThat(messages.get(2).type(), is(EventType.TxAbortedEvent));
}

private String doNothing() {
return "doNothing";
}
Expand Down

0 comments on commit 10558e5

Please sign in to comment.