diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java index e6e15904c..ae75e04ff 100644 --- a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java @@ -22,8 +22,9 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import static org.apache.seata.util.LogUtils.printProcessLog; @@ -35,6 +36,14 @@ public class SkyWalkingController { public static final int RETRY_MAX_TIMES = 3; private static final Logger LOGGER = LoggerFactory.getLogger(SkyWalkingController.class); private String e2eDir; + private static final Map caseOrder = new HashMap<>(); + + public SkyWalkingController() { + caseOrder.put('a', 1); + caseOrder.put('x', 2); + caseOrder.put('t', 3); + caseOrder.put('s', 4); + } public String getE2eDir() { return e2eDir; @@ -48,7 +57,15 @@ public void runE2ETests() { File e2eDir = new File(this.e2eDir); List passedProjects = new ArrayList<>(); File[] files = e2eDir.listFiles(); - List filterFiles = Arrays.stream(files).sorted(Comparator.reverseOrder()).collect(Collectors.toList()); + // use this order to run saga test first, because saga test is easy to fail + List filterFiles = Arrays.stream(files).sorted((a, b) -> { + int scoreA = caseOrder.getOrDefault(a.getName().charAt(0), 0); + int scoreB = caseOrder.getOrDefault(b.getName().charAt(0), 0); + if (scoreA == scoreB) { + return b.getName().compareTo(a.getName()); + } + return scoreB - scoreA; + }).collect(Collectors.toList()); for (File file : filterFiles) { if (file.isDirectory()) { LOGGER.info("Running Seate e2e test by SkyWalking-E2E: " + file.getName()); diff --git a/tcc-sample/spring-dubbo-seata-tcc/seata-e2e.yaml b/tcc-sample/spring-dubbo-seata-tcc/seata-e2e.yaml index 6f7ff4f9f..d231da845 100644 --- a/tcc-sample/spring-dubbo-seata-tcc/seata-e2e.yaml +++ b/tcc-sample/spring-dubbo-seata-tcc/seata-e2e.yaml @@ -23,7 +23,7 @@ e2e: condition: service_started environment: seata.address: seata - zookeeper.address: spring-dubbo-seata-tcc-provider + zookeeper.address: zookeeper E2E_ENV: open # provider service providers: @@ -34,9 +34,11 @@ e2e: depends_on: seata-server: condition: service_started + zookeeper: + condition: service_healthy environment: seata.address: seata - zookeeper.address: spring-dubbo-seata-tcc-provider + zookeeper.address: zookeeper E2E_ENV: open # infrastructure services infrastructures: @@ -50,6 +52,17 @@ e2e: environment: SEATA_PORT: 8091 STORE_MODE: file + - name: zookeeper + docker_service: + hostname: zookeeper + image: zookeeper:3.8.4 + # ports: + # - "2181:2181" + healthcheck: + test: '[ "CMD", "echo", "ruok", "|", "nc", "localhost", "2181", "|", "grep", "imok" ]' + interval: 30s + timeout: 10s + retries: 3 replace: - source: e2e-replace/file.conf diff --git a/tcc-sample/spring-dubbo-seata-tcc/spring-dubbo-seata-tcc-provider/src/main/java/org/apache/seata/stater/TccProviderStarter.java b/tcc-sample/spring-dubbo-seata-tcc/spring-dubbo-seata-tcc-provider/src/main/java/org/apache/seata/stater/TccProviderStarter.java index 04960b5e8..3552ccdf9 100644 --- a/tcc-sample/spring-dubbo-seata-tcc/spring-dubbo-seata-tcc-provider/src/main/java/org/apache/seata/stater/TccProviderStarter.java +++ b/tcc-sample/spring-dubbo-seata-tcc/spring-dubbo-seata-tcc-provider/src/main/java/org/apache/seata/stater/TccProviderStarter.java @@ -19,8 +19,6 @@ import org.apache.curator.test.TestingServer; import org.springframework.context.support.ClassPathXmlApplicationContext; -import java.io.IOException; - import static org.apache.seata.e2e.E2EUtil.isInE2ETest; public class TccProviderStarter { @@ -32,19 +30,19 @@ public static void main(String[] args) throws Exception { } protected void start0(String[] args) throws Exception { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - if (server != null) { - try { - server.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - })); - - - //mock zk server - mockZKServer(); +// Runtime.getRuntime().addShutdownHook(new Thread(() -> { +// if (server != null) { +// try { +// server.close(); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } +// })); +// +// +// //mock zk server +// mockZKServer(); if (isInE2ETest()) { // wait seata-server