From 1b3052fa4a43b4b5ab393aab6bb86ff5b2e60da3 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 1 Apr 2024 22:35:09 +0800 Subject: [PATCH 01/40] feat: add e2e framework support --- .github/workflows/E2E.yml | 21 +++ .../dubbo-samples-seata-account/pom.xml | 4 + .../docker-compose.yaml | 70 ++++++++ .../e2e-files/expected.yaml | 1 + .../e2e-files/sqlsh/all.sql | 56 ++++++ .../springboot-dubbo-seata/seata-e2e.yaml | 100 +++++++++++ .../springboot-dubbo-seata-business/pom.xml | 5 + ...ringbootDubboSeataBusinessApplication.java | 6 +- .../org/apache/seata/e2e/E2EController.java | 47 +++++ .../src/main/resources/application.properties | 5 +- .../seata/service/impl/OrderServiceImpl.java | 2 + e2e-test/e2e-test-builder/.gitignore | 38 ++++ e2e-test/e2e-test-builder/pom.xml | 57 ++++++ .../java/org/apache/seata/BuilderMain.java | 19 ++ .../org/apache/seata/builder/E2EBuilder.java | 50 ++++++ .../apache/seata/builder/ImageBuilder.java | 107 +++++++++++ .../apache/seata/builder/SceneBuilder.java | 62 +++++++ .../apache/seata/config/ConfigConstants.java | 14 ++ .../org/apache/seata/config/ConfigReader.java | 24 +++ .../generator/DockerComposeGenerator.java | 56 ++++++ .../generator/DockerFileForJarGenerator.java | 62 +++++++ .../generator/SkyWalkingE2EFileGenerator.java | 52 ++++++ .../java/org/apache/seata/model/Case.java | 34 ++++ .../java/org/apache/seata/model/DependOn.java | 34 ++++ .../org/apache/seata/model/DockerService.java | 118 +++++++++++++ .../org/apache/seata/model/E2EConfig.java | 52 ++++++ .../org/apache/seata/model/E2EWrapper.java | 17 ++ .../java/org/apache/seata/model/Inherit.java | 27 +++ .../java/org/apache/seata/model/Module.java | 61 +++++++ .../java/org/apache/seata/model/Modules.java | 36 ++++ .../java/org/apache/seata/model/Retry.java | 34 ++++ .../java/org/apache/seata/util/Utils.java | 34 ++++ .../src/main/resources/template/at-common | 0 .../main/resources/template/dockercompose.ftl | 167 ++++++++++++++++++ .../resources/template/jar-dockerFile.ftl | 3 + .../resources/template/skywalking-e2e.ftl | 31 ++++ e2e-test/e2e-test-runner/.gitignore | 38 ++++ e2e-test/e2e-test-runner/pom.xml | 21 +++ .../java/org/apache/seata/RunnerMain.java | 20 +++ .../controller/SkyWalkingController.java | 47 +++++ e2e-test/pom.xml | 63 +++++++ 41 files changed, 1690 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/E2E.yml create mode 100644 at-sample/springboot-dubbo-seata/docker-compose.yaml create mode 100644 at-sample/springboot-dubbo-seata/e2e-files/expected.yaml create mode 100644 at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql create mode 100644 at-sample/springboot-dubbo-seata/seata-e2e.yaml create mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java create mode 100644 e2e-test/e2e-test-builder/.gitignore create mode 100644 e2e-test/e2e-test-builder/pom.xml create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/at-common create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl create mode 100644 e2e-test/e2e-test-runner/.gitignore create mode 100644 e2e-test/e2e-test-runner/pom.xml create mode 100644 e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java create mode 100644 e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java create mode 100644 e2e-test/pom.xml diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml new file mode 100644 index 000000000..261df6c95 --- /dev/null +++ b/.github/workflows/E2E.yml @@ -0,0 +1,21 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ e2e-demo ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ e2e-demo ] +# +#jobs: \ No newline at end of file diff --git a/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml b/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml index 3d4f98cf2..ddc278e2c 100644 --- a/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml +++ b/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml @@ -57,6 +57,10 @@ io.seata seata-spring-boot-starter + + org.springframework.boot + spring-boot-starter-web + diff --git a/at-sample/springboot-dubbo-seata/docker-compose.yaml b/at-sample/springboot-dubbo-seata/docker-compose.yaml new file mode 100644 index 000000000..163afa922 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/docker-compose.yaml @@ -0,0 +1,70 @@ +version: "3.9" +services: + account: + hostname: account + image: springboot-dubbo-seata-account:0.0.1 + restart: on-failure + depends_on: + - seata-server + - zookeeper + - mysql + business: + hostname: business + image: springboot-dubbo-seata-business:0.0.1 + restart: on-failure + depends_on: + - account + - order + - storage + order: + hostname: order + image: springboot-dubbo-seata-order:0.0.1 + restart: on-failure + depends_on: + - seata-server + - zookeeper + - mysql + storage: + hostname: storage + image: springboot-dubbo-seata-storage:0.0.1 + restart: on-failure + depends_on: + - seata-server + - zookeeper + - mysql + mysql: + hostname: businessmysql + image: mysql:5.7 + volumes: + - ./sqlsh:/docker-entrypoint-initdb.d + restart: always + environment: + MYSQL_ROOT_PASSWORD: 123456 + MYSQL_DATABASE: storage + MYSQL_USER: user + MYSQL_PASSWORD: user + # ports: + # - "3307:3306" + networks: + - host + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + interval: 5s + timeout: 10s + retries: 10 + seata-server: + image: seataio/seata-server:${latest-release-version} + hostname: seata-server + ports: + - "7091:7091" + - "8091:8091" + environment: + - SEATA_PORT=8091 + - STORE_MODE=file + zookeeper: + hostname: zookeeper + image: zookeeper:3.7.1 + + +networks: + host: \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml new file mode 100644 index 000000000..946b0e70c --- /dev/null +++ b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml @@ -0,0 +1 @@ +{"res": "success"} \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql b/at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql new file mode 100644 index 000000000..a6974d7f6 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql @@ -0,0 +1,56 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +CREATE TABLE `account_tbl` +( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` varchar(255) DEFAULT NULL, + `money` int(11) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE `stock_tbl` +( + `id` int(11) NOT NULL AUTO_INCREMENT, + `commodity_code` varchar(255) DEFAULT NULL, + `count` int(11) DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `commodity_code` (`commodity_code`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE `order_tbl` +( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` varchar(255) DEFAULT NULL, + `commodity_code` varchar(255) DEFAULT NULL, + `count` int(11) DEFAULT '0', + `money` int(11) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `undo_log` +( + `branch_id` BIGINT NOT NULL COMMENT 'branch transaction id', + `xid` VARCHAR(128) NOT NULL COMMENT 'global transaction id', + `context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization', + `rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info', + `log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status', + `log_created` DATETIME(6) NOT NULL COMMENT 'create datetime', + `log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime', + UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`) + ) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='AT transaction mode undo table'; +ALTER TABLE `undo_log` ADD INDEX `ix_log_created` (`log_created`); \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml new file mode 100644 index 000000000..800d82183 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -0,0 +1,100 @@ +e2e: + scene_name: at-springboot-dubbo-seata + # 后期考虑扩展成通用基础设施一键配置 + inherit: + name: at-common + # retry config + retry: + max: 5 + interval: 10s + total_timeout: 20m + # 多服务配置, 有一个test模块用于触发测试,其余皆为provider + modules: + # 划分为不同的模块后续可以做功能扩展 + consumers: + # docker service name + - name: springboot-dubbo-seata-business + # 这里可以加一些插件实现不同功能 + # docker service 下的参数,这样写是为了方便后续扩展解耦 + docker_service: + network_mode: host + restart: on-failure + container_name: test + depends_on: + springboot-dubbo-seata-account: + condition: service_started + springboot-dubbo-seata-storage: + condition: service_started + springboot-dubbo-seata-order: + condition: service_started + providers: + - name: springboot-dubbo-seata-account + docker_service: + network_mode: host + restart: on-failure + depends_on: + zookeeper: + condition: service_healthy + mysql: + condition: service_healthy + - name: springboot-dubbo-seata-order + docker_service: + network_mode: host + restart: on-failure + depends_on: + zookeeper: + condition: service_healthy + mysql: + condition: service_healthy + - name: springboot-dubbo-seata-storage + docker_service: + network_mode: host + restart: on-failure + depends_on: + zookeeper: + condition: service_healthy + mysql: + condition: service_healthy + infrastructures: + - name: mysql + docker_service: + image: mysql:5.7 + ports: + - "3307:3306" + volumes: + - ./e2e-files/sqlsh:/docker-entrypoint-initdb.d + restart: always + environment: + MYSQL_ROOT_PASSWORD: 123456 + MYSQL_DATABASE: seata + MYSQL_USER: user + MYSQL_PASSWORD: 123456 + healthcheck: + test: '[ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]' + interval: 5s + timeout: 10s + retries: 10 + - name: seata-server + docker_service: + image: seataio/seata-server:2.0.0 + ports: + - "7091:7091" + - "8091:8091" + environment: + SEATA_PORT: 8091 + STORE_MODE: file + - name: zookeeper + docker_service: + image: zookeeper:3.5.7 + ports: + - "2181:2181" + healthcheck: + test: '[ "CMD", "echo", "ruok", "|", "nc", "localhost", "2181", "|", "grep", "imok" ]' + interval: 30s + timeout: 10s + retries: 3 + + cases: + - name: normal test + invoke: 'docker exec test curl http://127.0.0.1:9991/testCreate' + verify: './e2e-files/expected.yaml' \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml index 5e9168528..89a4b1765 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml @@ -97,6 +97,11 @@ springboot-dubbo-seata-common 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java index 22cd54d86..133d57271 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java @@ -31,9 +31,9 @@ public class SpringbootDubboSeataBusinessApplication implements BeanFactoryAware public static void main(String[] args) throws Exception { SpringApplication.run(SpringbootDubboSeataBusinessApplication.class, args); - BusinessService businessService = BEAN_FACTORY.getBean(BusinessService.class); - - businessService.purchase("U100001", "C00321", 2); +// BusinessService businessService = BEAN_FACTORY.getBean(BusinessService.class); +// +// businessService.purchase("U100001", "C00321", 2); } @Override diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java new file mode 100644 index 000000000..83e179d80 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java @@ -0,0 +1,47 @@ +package org.apache.seata.e2e; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.seata.service.BusinessService; +import org.apache.seata.service.OrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.yaml.snakeyaml.Yaml; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +@RestController +public class E2EController { + @Autowired + private BusinessService businessService; + + @GetMapping("testCreate") + public void testCreate(HttpServletResponse response) throws IOException { + Map res = new HashMap<>(); + // 设置响应类型 + response.setContentType("text/yaml"); + response.setCharacterEncoding("UTF-8"); + + Yaml yaml = new Yaml(); + try { + businessService.purchase("U100001", "C00321", 2); + } catch (Exception e) { + e.printStackTrace(); + res.put("res", "failed"); + String yamlStr = yaml.dump(res); + response.getWriter().write(yamlStr); + return; + } + res.put("res", "success"); + String yamlStr = yaml.dump(res); + response.getWriter().write(yamlStr); + } +} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties index 4dc07526d..f220ff15b 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties @@ -3,6 +3,7 @@ seata.application-id=springboot-dubbo-seata-business seata.tx-service-group=my_test_tx_group dubbo.application.qos-enable=false dubbo.scan.base-packages=org.apache.seata -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo -dubbo.protocol.port=20883 \ No newline at end of file +dubbo.protocol.port=20883 +server.port=9991 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java index d0617e3ba..4babcb4a5 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java @@ -26,12 +26,14 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; +import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.sql.PreparedStatement; import java.util.Objects; @DubboService +@Component public class OrderServiceImpl implements OrderService { private static final Logger LOGGER = LoggerFactory.getLogger(OrderService.class); diff --git a/e2e-test/e2e-test-builder/.gitignore b/e2e-test/e2e-test-builder/.gitignore new file mode 100644 index 000000000..5ff6309b7 --- /dev/null +++ b/e2e-test/e2e-test-builder/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/e2e-test/e2e-test-builder/pom.xml b/e2e-test/e2e-test-builder/pom.xml new file mode 100644 index 000000000..01b3a38d8 --- /dev/null +++ b/e2e-test/e2e-test-builder/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + + org.apache.seata + e2e-test + 2.0.0 + + org.apache.seata + e2e-test-builder + 2.0.0 + e2e-test-builder + + + + org.yaml + snakeyaml + + + org.freemarker + freemarker + + + org.slf4j + slf4j-api + + + ch.qos.logback + logback-classic + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + log4j-over-slf4j + + + commons-io + commons-io + 2.11.0 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java new file mode 100644 index 000000000..2cb9e9148 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java @@ -0,0 +1,19 @@ +package org.apache.seata; + +import org.apache.seata.builder.E2EBuilder; + +import java.io.IOException; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class BuilderMain { + public static void main(String[] args) throws IOException, InterruptedException { + E2EBuilder e2EBuilder = new E2EBuilder(); + e2EBuilder.setRootPath("./"); + if (args != null && args.length == 1) { + e2EBuilder.setRootPath(args[1]); + } + e2EBuilder.buildSeataE2ETest(); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java new file mode 100644 index 000000000..5009d5a36 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java @@ -0,0 +1,50 @@ +package org.apache.seata.builder; + +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.config.ConfigReader; +import org.apache.seata.model.E2EConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class E2EBuilder { + private String rootPath; + private static final Logger LOGGER = LoggerFactory.getLogger(E2EBuilder.class); + + public String getRootPath() { + return rootPath; + } + + public void setRootPath(String rootPath) { + this.rootPath = rootPath; + } + + public void buildSeataE2ETest() throws IOException, InterruptedException { + File root = new File(rootPath); + searchAndBuild(root); + } + + private void searchAndBuild(File dir) throws IOException, InterruptedException { + File[] files = dir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + searchAndBuild(file); + File configFile = new File(file, ConfigConstants.SEATA_E2E_FILE); + if (configFile.exists()) { + E2EConfig e2EConfig = ConfigReader.readConfig(configFile); + ImageBuilder imageBuilder = new ImageBuilder(); + imageBuilder.BuildImage(e2EConfig, file); + SceneBuilder sceneBuilder = new SceneBuilder(); + sceneBuilder.buildScene(e2EConfig, file); + } + } + } + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java new file mode 100644 index 000000000..69700e6b6 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java @@ -0,0 +1,107 @@ +package org.apache.seata.builder; + +import org.apache.seata.generator.DockerFileForJarGenerator; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.apache.seata.util.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.List; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class ImageBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(ImageBuilder.class); + + public void BuildImage(E2EConfig e2EConfig, File moduleDir) throws IOException, InterruptedException { + int exitCode = packageMavenParentModule(moduleDir); + if (exitCode == 0) { + buildDockerImage(moduleDir, e2EConfig); + } + } + + private int packageMavenParentModule(File moduleDir) throws IOException, InterruptedException { + LOGGER.info("Packaging Maven module: " + moduleDir.getPath()); + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(moduleDir); + builder.command("mvn.cmd", "clean", "package"); + Process process = builder.start(); + Utils.printProcessLog(LOGGER, process); + int exitCode = process.waitFor(); + LOGGER.info(String.format("Maven module %s packaging finished with exit code %d", moduleDir, exitCode)); + return exitCode; + } + + private void buildDockerImage(File parentModuleDir, E2EConfig e2EConfig) throws IOException, InterruptedException { + LOGGER.info("Building Docker image for maven parent module: " + parentModuleDir.getPath()); + File[] files = parentModuleDir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + if (copyJarInMavenChildModule(file, e2EConfig) == null) { + LOGGER.warn("Copying jar in Maven child module failed: " + file.getPath()); + } + } + } + } + prepareDockerfile(e2EConfig); + runDockerBuild(e2EConfig); + } + + private void runDockerBuild(E2EConfig e2EConfig) throws IOException, InterruptedException { + LOGGER.info(String.format("Building Docker image for scene %s", e2EConfig.getScene_name())); + String tmpDir = ConfigConstants.IMAGE_DIR; + File composeDir = new File(tmpDir); + List modules = new ArrayList<>(); + modules.addAll(e2EConfig.getModules().getConsumers()); + modules.addAll(e2EConfig.getModules().getProviders()); + for (Module module : modules) { + String moduleComposeDir = new File(composeDir, e2EConfig.getScene_name() + "-" + + module.getName()).getAbsolutePath(); + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(new File(moduleComposeDir)); + builder.command("docker", "build", "-t", String.format("%s:%s", module.getName(), "0.0.1"), "."); + Process process = builder.start(); + Utils.printProcessLog(LOGGER, process); + int exitCode = process.waitFor(); + if (exitCode != 0) { + LOGGER.warn(String.format("Docker image for module %s build failed with exit code %d", module.getName(), exitCode)); + } + } + } + + private void prepareDockerfile(E2EConfig e2EConfig) { + LOGGER.info(String.format("Generating Dockerfile for scene %s", e2EConfig.getScene_name())); + DockerFileForJarGenerator generator = new DockerFileForJarGenerator(); + generator.generateDockerFiles(e2EConfig); + } + + private File copyJarInMavenChildModule(File moduleDir, E2EConfig e2EConfig) throws IOException { + LOGGER.info("Copying jar in Maven child module: " + moduleDir.getPath()); + File targetDir = new File(moduleDir, "target"); + if (targetDir.exists() && targetDir.isDirectory()) { + File[] files = targetDir.listFiles((dir, name) -> name.endsWith(".jar")); + if (files != null && files.length == 1) { + Path dir = Paths.get(ConfigConstants.IMAGE_DIR, e2EConfig.getScene_name() + "-" + + moduleDir.getName()); + Files.createDirectories(dir); + Path destPath = Paths.get(dir.toAbsolutePath().toString(), moduleDir.getName() + ".jar"); + Files.copy(files[0].toPath(), destPath, StandardCopyOption.REPLACE_EXISTING); + LOGGER.info("Copying jar in Maven child module success" + moduleDir.getPath()); + return destPath.toFile(); + } + return null; + } + return null; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java new file mode 100644 index 000000000..ea46bd319 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java @@ -0,0 +1,62 @@ +package org.apache.seata.builder; + +import org.apache.commons.io.file.PathUtils; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.generator.DockerComposeGenerator; +import org.apache.seata.generator.SkyWalkingE2EFileGenerator; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +import static org.apache.seata.config.ConfigConstants.E2E_FILES; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class SceneBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(SceneBuilder.class); + + public void buildScene(E2EConfig e2EConfig, File file) throws IOException { + initE2EConfigForSceneBuild(e2EConfig); + Path sceneDir = Paths.get(ConfigConstants.SCENE_DIR, e2EConfig.getScene_name()); + Files.createDirectories(sceneDir); + copyE2EResource(file, sceneDir); + generateTestFiles(e2EConfig, sceneDir); + } + + private void initE2EConfigForSceneBuild(E2EConfig e2EConfig) { + for (Module provider : e2EConfig.getModules().getProviders()) { + provider.getDocker_service().setImage( + provider.getName() + ":" + ConfigConstants.IMAGE_VERSION); + } + for (Module consumer : e2EConfig.getModules().getConsumers()) { + consumer.getDocker_service().setImage( + consumer.getName() + ":" + ConfigConstants.IMAGE_VERSION); + } + } + + private void generateTestFiles(E2EConfig e2EConfig, Path sceneDir) { + DockerComposeGenerator dockerComposeGenerator = new DockerComposeGenerator(); + dockerComposeGenerator.generateDockerComposeFile(e2EConfig, sceneDir.toFile()); + SkyWalkingE2EFileGenerator skyWalkingE2EFileGenerator = new SkyWalkingE2EFileGenerator(); + skyWalkingE2EFileGenerator.generateSkyWalkingE2EFile(e2EConfig, sceneDir.toFile()); + } + + private void copyE2EResource(File file, Path sceneDir) throws IOException { + File[] resources = file.listFiles((tempFile) -> E2E_FILES.equals(tempFile.getName())); + if (resources == null || resources.length != 1) { + LOGGER.error(String.format("find e2e-files in file: %s", file)); + throw new RuntimeException("e2e-files not found"); + } + PathUtils.copyDirectory(resources[0].toPath(), Paths.get(sceneDir.toString(), E2E_FILES), + StandardCopyOption.REPLACE_EXISTING); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java new file mode 100644 index 000000000..069c7ca7c --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java @@ -0,0 +1,14 @@ +package org.apache.seata.config; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class ConfigConstants { + public static final String IMAGE_DIR = "tmp/images"; + public static final String SCENE_DIR = "tmp/scene-test"; + public static final String SEATA_E2E_FILE = "seata-e2e.yaml"; + public static final String E2E_FILES = "e2e-files"; + public static final String COMPOSE_FILE = "docker-compose.yaml"; + public static final String SKY_WALKING_E2E_FILE = "e2e.yaml"; + public static final String IMAGE_VERSION = "0.0.1"; +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java new file mode 100644 index 000000000..dceddaa48 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java @@ -0,0 +1,24 @@ +package org.apache.seata.config; + +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.E2EWrapper; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.Constructor; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class ConfigReader { + public static E2EConfig readConfig(File configFile) throws IOException { + Yaml yaml = new Yaml(new Constructor(E2EWrapper.class)); + E2EWrapper e2EWrapper = new E2EWrapper(); + InputStream inputStream = Files.newInputStream(configFile.toPath()); + // 从YAML文件读取数据并转换为Java对象 + e2EWrapper = yaml.load(inputStream); + return e2EWrapper.getE2e(); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java new file mode 100644 index 000000000..4a1def83f --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java @@ -0,0 +1,56 @@ +package org.apache.seata.generator; + +import freemarker.template.Configuration; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.apache.seata.model.Modules; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.apache.seata.config.ConfigConstants.COMPOSE_FILE; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DockerComposeGenerator { + private static final Logger LOGGER = LoggerFactory.getLogger(DockerComposeGenerator.class); + private final Configuration cfg; + + public DockerComposeGenerator() { + cfg = new Configuration(Configuration.VERSION_2_3_28); + try { + cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/template"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setWrapUncheckedExceptions(true); + cfg.setNumberFormat("computer"); + } catch (Exception e) { + // never to do this + } + } + + public void generateDockerComposeFile(E2EConfig e2EConfig, File file) { + try { + Modules modules = e2EConfig.getModules(); + Map map = new HashMap<>(); + map.put("modules", modules); + cfg.getTemplate("dockercompose.ftl") + .process(map, new FileWriter(new File(file, COMPOSE_FILE))); + } catch (TemplateException | IOException e) { + LOGGER.error(String.format("generate docker-compose file for %s fail", e2EConfig.getScene_name() + + "-" + e2EConfig.getScene_name()), e); + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java new file mode 100644 index 000000000..5645ddcd6 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java @@ -0,0 +1,62 @@ +package org.apache.seata.generator; + +import freemarker.template.Configuration; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DockerFileForJarGenerator { + private static final Logger LOGGER = LoggerFactory.getLogger(DockerFileForJarGenerator.class); + private final Configuration cfg; + + public DockerFileForJarGenerator() { + cfg = new Configuration(Configuration.VERSION_2_3_28); + try { + cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/template"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setWrapUncheckedExceptions(true); + cfg.setNumberFormat("computer"); + } catch (Exception e) { + // never to do this + } + } + + public void generateDockerFiles(E2EConfig e2EConfig) { + String tmpDir = ConfigConstants.IMAGE_DIR; + File composeDir = new File(tmpDir); + List modules = new ArrayList<>(); + modules.addAll(e2EConfig.getModules().getConsumers()); + modules.addAll(e2EConfig.getModules().getProviders()); + for (Module module : modules) { + String moduleComposeDir = new File(composeDir, e2EConfig.getScene_name() + "-" + + module.getName()).getAbsolutePath(); + try { + Map props = new HashMap<>(); + props.put("sourceJar", module.getName() + ".jar"); +// props.put("port", module.getPort()); + cfg.getTemplate("jar-dockerFile.ftl") + .process(props, new FileWriter(new File(moduleComposeDir, "Dockerfile"))); + } catch (TemplateException | IOException e) { + LOGGER.error(String.format("generate docker file %s fail", e2EConfig.getScene_name() + + "-" + module.getName()), e); + } + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java new file mode 100644 index 000000000..14724a086 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java @@ -0,0 +1,52 @@ +package org.apache.seata.generator; + +import freemarker.template.Configuration; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static org.apache.seata.config.ConfigConstants.COMPOSE_FILE; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class SkyWalkingE2EFileGenerator { + private static final Logger LOGGER = LoggerFactory.getLogger(SkyWalkingE2EFileGenerator.class); + private final Configuration cfg; + + public SkyWalkingE2EFileGenerator() { + cfg = new Configuration(Configuration.VERSION_2_3_28); + try { + cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/template"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setWrapUncheckedExceptions(true); + cfg.setNumberFormat("computer"); + } catch (Exception e) { + // never to do this + } + } + + public void generateSkyWalkingE2EFile(E2EConfig e2EConfig, File file) { + try { + Map map = new HashMap<>(); + map.put("retry", e2EConfig.getRetry()); + map.put("cases", e2EConfig.getCases()); + cfg.getTemplate("skywalking-e2e.ftl") + .process(map, new FileWriter(new File(file, ConfigConstants.SKY_WALKING_E2E_FILE))); + } catch (TemplateException | IOException e) { + LOGGER.error(String.format("generate SkyWalking e2e test file for %s fail", e2EConfig.getScene_name() + + "-" + e2EConfig.getScene_name()), e); + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java new file mode 100644 index 000000000..d9280da6b --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java @@ -0,0 +1,34 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Case { + private String name; + private String invoke; + private String verify; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getInvoke() { + return invoke; + } + + public void setInvoke(String invoke) { + this.invoke = invoke; + } + + public String getVerify() { + return verify; + } + + public void setVerify(String verify) { + this.verify = verify; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java new file mode 100644 index 000000000..8b1ef8dc9 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java @@ -0,0 +1,34 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DependOn { + private String restart; + private String condition; + private String required; + + public String getRestart() { + return restart; + } + + public void setRestart(String restart) { + this.restart = restart; + } + + public String getCondition() { + return condition; + } + + public void setCondition(String condition) { + this.condition = condition; + } + + public String getRequired() { + return required; + } + + public void setRequired(String required) { + this.required = required; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java new file mode 100644 index 000000000..44e3609ca --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java @@ -0,0 +1,118 @@ +package org.apache.seata.model; + +import java.util.List; +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DockerService { + private String name; + private String image; + private String networks; + private String network_mode; + private String hostname; + private String restart; + private List ports; + private Map healthcheck; + private Map depends_on; + private Map environment; + private List volumes; + private String container_name; + + public String getContainer_name() { + return container_name; + } + + public void setContainer_name(String container_name) { + this.container_name = container_name; + } + + public String getNetwork_mode() { + return network_mode; + } + + public void setNetwork_mode(String network_mode) { + this.network_mode = network_mode; + } + + public String getNetworks() { + return networks; + } + + public void setNetworks(String networks) { + this.networks = networks; + } + + public String getRestart() { + return restart; + } + + public void setRestart(String restart) { + this.restart = restart; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public List getPorts() { + return ports; + } + + public void setPorts(List ports) { + this.ports = ports; + } + + public Map getHealthcheck() { + return healthcheck; + } + + public void setHealthcheck(Map healthcheck) { + this.healthcheck = healthcheck; + } + + public Map getDepends_on() { + return depends_on; + } + + public void setDepends_on(Map depends_on) { + this.depends_on = depends_on; + } + + public Map getEnvironment() { + return environment; + } + + public void setEnvironment(Map environment) { + this.environment = environment; + } + + public List getVolumes() { + return volumes; + } + + public void setVolumes(List volumes) { + this.volumes = volumes; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java new file mode 100644 index 000000000..d4e4a0b17 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java @@ -0,0 +1,52 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class E2EConfig { + private Inherit inherit; + private String scene_name; + private Retry retry; + private Modules modules; + private Case[] cases; + + public Case[] getCases() { + return cases; + } + + public void setCases(Case[] cases) { + this.cases = cases; + } + + public Inherit getInherit() { + return inherit; + } + + public void setInherit(Inherit inherit) { + this.inherit = inherit; + } + + public String getScene_name() { + return scene_name; + } + + public void setScene_name(String scene_name) { + this.scene_name = scene_name; + } + + public Retry getRetry() { + return retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Modules getModules() { + return modules; + } + + public void setModules(Modules modules) { + this.modules = modules; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java new file mode 100644 index 000000000..c3dd36018 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java @@ -0,0 +1,17 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class E2EWrapper { + private E2EConfig e2e; + + // Getters and Setters + public E2EConfig getE2e() { + return e2e; + } + + public void setE2e(E2EConfig e2e) { + this.e2e = e2e; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java new file mode 100644 index 000000000..7188140af --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java @@ -0,0 +1,27 @@ +package org.apache.seata.model; + +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Inherit { + private String name; + private Map props; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Map getProps() { + return props; + } + + public void setProps(Map props) { + this.props = props; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java new file mode 100644 index 000000000..af8ed5e14 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java @@ -0,0 +1,61 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Module { + private String name; + private String dir; + private String invoke; + private String port; + private String expect; + private DockerService docker_service; + + public String getExpect() { + return expect; + } + + public void setExpect(String expect) { + this.expect = expect; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DockerService getDocker_service() { + return docker_service; + } + + public void setDocker_service(DockerService docker_service) { + this.docker_service = docker_service; + } + + public String getDir() { + return dir; + } + + public void setDir(String dir) { + this.dir = dir; + } + + public String getInvoke() { + return invoke; + } + + public void setInvoke(String invoke) { + this.invoke = invoke; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java new file mode 100644 index 000000000..ee2ca370f --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java @@ -0,0 +1,36 @@ +package org.apache.seata.model; + +import java.util.List; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Modules { + private List consumers; + private List providers; + private List infrastructures; + + public List getInfrastructures() { + return infrastructures; + } + + public void setInfrastructures(List infrastructures) { + this.infrastructures = infrastructures; + } + + public List getConsumers() { + return consumers; + } + + public void setConsumers(List consumers) { + this.consumers = consumers; + } + + public List getProviders() { + return providers; + } + + public void setProviders(List providers) { + this.providers = providers; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java new file mode 100644 index 000000000..cb7383f8f --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java @@ -0,0 +1,34 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Retry { + private int max; + private String interval ; + private String total_timeout; + + public String getTotal_timeout() { + return total_timeout; + } + + public void setTotal_timeout(String total_timeout) { + this.total_timeout = total_timeout; + } + + public int getMax() { + return max; + } + + public void setMax(int max) { + this.max = max; + } + + public String getInterval() { + return interval; + } + + public void setInterval(String interval) { + this.interval = interval; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java new file mode 100644 index 000000000..f2f13f6bc --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java @@ -0,0 +1,34 @@ +package org.apache.seata.util; + +import org.slf4j.Logger; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Utils { + public static void printProcessLog(Logger LOGGER, Process process) { + ExecutorService executor = Executors.newFixedThreadPool(2); + + // 分别为标准输出和错误输出创建并启动线程 + executor.submit(() -> printStream(LOGGER, process.getInputStream(), false)); + executor.submit(() -> printStream(LOGGER, process.getErrorStream(), true)); + + executor.shutdown(); + } + + private static void printStream(Logger LOGGER, InputStream inputStream, boolean isError) { + new BufferedReader(new InputStreamReader(inputStream)).lines().forEach(line -> { + if (isError) { + LOGGER.warn(line); + } else { + LOGGER.info(line); + } + }); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/at-common b/e2e-test/e2e-test-builder/src/main/resources/template/at-common new file mode 100644 index 000000000..e69de29bb diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl new file mode 100644 index 000000000..2fdc58012 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl @@ -0,0 +1,167 @@ +version: "3.9" +services: +<#list modules.consumers as service> + ${service.name}: + <#if service.docker_service.image?has_content> + image: ${service.docker_service.image} + + <#if service.docker_service.networks?has_content> + networks: ${service.docker_service.networks} + + <#if service.docker_service.network_mode?has_content> + network_mode: ${service.docker_service.network_mode} + + <#if service.docker_service.hostname?has_content> + hostname: ${service.docker_service.hostname} + + <#if service.docker_service.restart??> + restart: ${service.docker_service.restart} + + <#if service.docker_service.build?has_content> + build: ${service.docker_service.build} + + <#if service.docker_service.container_name?has_content> + container_name: ${service.docker_service.container_name} + + <#if service.docker_service.volumes??> + volumes: + <#list service.docker_service.volumes as volume> + - ${volume} + + + <#if service.docker_service.environment??> + environment: + <#list service.docker_service.environment as key,value> + ${key}: ${value} + + + <#if service.docker_service.ports??> + ports: + <#list service.docker_service.ports as port> + - ${port} + + + <#if service.docker_service.depends_on??> + depends_on: + <#list service.docker_service.depends_on?keys as key> + ${key}: + condition: ${service.docker_service.depends_on[key].condition} + + + <#if service.docker_service.healthcheck??> + healthcheck: + <#list service.docker_service.healthcheck as key,value> + ${key}: ${value} + + + +<#list modules.providers as service> + ${service.name}: + <#if service.docker_service.image?has_content> + image: ${service.docker_service.image} + + <#if service.docker_service.networks?has_content> + networks: ${service.docker_service.networks} + + <#if service.docker_service.network_mode?has_content> + network_mode: ${service.docker_service.network_mode} + + <#if service.docker_service.hostname?has_content> + hostname: ${service.docker_service.hostname} + + <#if service.docker_service.restart??> + restart: ${service.docker_service.restart} + + <#if service.docker_service.build?has_content> + build: ${service.docker_service.build} + + <#if service.docker_service.container_name?has_content> + container_name: ${service.docker_service.container_name} + + <#if service.docker_service.volumes??> + volumes: + <#list service.docker_service.volumes as volume> + - ${volume} + + + <#if service.docker_service.environment??> + environment: + <#list service.docker_service.environment as key,value> + ${key}: ${value} + + + <#if service.docker_service.ports??> + ports: + <#list service.docker_service.ports as port> + - ${port} + + + <#if service.docker_service.depends_on??> + depends_on: + <#list service.docker_service.depends_on?keys as key> + ${key}: + condition: ${service.docker_service.depends_on[key].condition} + + + <#if service.docker_service.healthcheck??> + healthcheck: + <#list service.docker_service.healthcheck as key,value> + ${key}: ${value} + + + +<#list modules.infrastructures as service> + ${service.name}: + <#if service.docker_service.image?has_content> + image: ${service.docker_service.image} + + <#if service.docker_service.networks?has_content> + networks: ${service.docker_service.networks} + + <#if service.docker_service.network_mode?has_content> + network_mode: ${service.docker_service.network_mode} + + <#if service.docker_service.hostname?has_content> + hostname: ${service.docker_service.hostname} + + <#if service.docker_service.restart??> + restart: ${service.docker_service.restart} + + <#if service.docker_service.build?has_content> + build: ${service.docker_service.build} + + <#if service.docker_service.container_name?has_content> + container_name: ${service.docker_service.container_name} + + <#if service.docker_service.volumes??> + volumes: + <#list service.docker_service.volumes as volume> + - ${volume} + + + <#if service.docker_service.environment??> + environment: + <#list service.docker_service.environment as key,value> + ${key}: ${value} + + + <#if service.docker_service.ports??> + ports: + <#list service.docker_service.ports as port> + - ${port} + + + <#if service.docker_service.depends_on??> + depends_on: + <#list service.docker_service.depends_on?keys as key> + ${key}: + condition: ${service.docker_service.depends_on[key].condition} + + + <#if service.docker_service.healthcheck??> + healthcheck: + <#list service.docker_service.healthcheck as key,value> + ${key}: ${value} + + + diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl new file mode 100644 index 000000000..75d032f6e --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl @@ -0,0 +1,3 @@ +FROM java:8 +COPY ${sourceJar} /app.jar +ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl new file mode 100644 index 000000000..5a0ad2821 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl @@ -0,0 +1,31 @@ +setup: + env: compose + # Run a httpbin container, which can return YAML data + file: docker-compose.yaml + timeout: ${retry.total_timeout} + +cleanup: + # always never success failure + on: always + +verify: + # verify with retry strategy + retry: + # max retry count + count: ${retry.max} + # the interval between two attempts, e.g. 10s, 1m. + interval: ${retry.interval} + + # when a case fails, whether to stop verifying other cases. This property defaults to true. + fail-fast: false + # Whether to verify cases concurrently. This property defaults to false. + concurrency: false + + cases: + <#if cases??> + <#list cases as case> + - name: ${case.name} + query: ${case.invoke} + expected: ${case.verify} + + diff --git a/e2e-test/e2e-test-runner/.gitignore b/e2e-test/e2e-test-runner/.gitignore new file mode 100644 index 000000000..5ff6309b7 --- /dev/null +++ b/e2e-test/e2e-test-runner/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/e2e-test/e2e-test-runner/pom.xml b/e2e-test/e2e-test-runner/pom.xml new file mode 100644 index 000000000..b0fb7c194 --- /dev/null +++ b/e2e-test/e2e-test-runner/pom.xml @@ -0,0 +1,21 @@ + + 4.0.0 + + org.apache.seata + e2e-test + 2.0.0 + + org.apache.seata + e2e-test-runner + 2.0.0 + e2e-test-runner + + + + org.apache.seata + e2e-test-builder + 2.0.0 + + + diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java new file mode 100644 index 000000000..a57a72ff2 --- /dev/null +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java @@ -0,0 +1,20 @@ +package org.apache.seata; + +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.controller.SkyWalkingController; + +import java.io.IOException; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class RunnerMain { + public static void main(String[] args) throws IOException, InterruptedException { + SkyWalkingController skyWalkingController = new SkyWalkingController(); + skyWalkingController.setE2eDir(ConfigConstants.SCENE_DIR); + if (args != null && args.length == 1) { + skyWalkingController.setE2eDir(args[1]); + } + skyWalkingController.runE2ETests(); + } +} 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 new file mode 100644 index 000000000..ec70cf0a5 --- /dev/null +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java @@ -0,0 +1,47 @@ +package org.apache.seata.controller; + +import org.apache.seata.generator.DockerComposeGenerator; +import org.apache.seata.util.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class SkyWalkingController { + private static final Logger LOGGER = LoggerFactory.getLogger(SkyWalkingController.class); + private String e2eDir; + + public String getE2eDir() { + return e2eDir; + } + + public void setE2eDir(String e2eDir) { + this.e2eDir = e2eDir; + } + + public void runE2ETests() { + File e2eDir = new File(this.e2eDir); + for (File file : e2eDir.listFiles()) { + if (file.isDirectory()) { + LOGGER.info("Running Seate e2e test by SkyWalking-E2E: " + file.getName()); + try { + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(file); + builder.command("e2e", "run"); + Process process = builder.start(); + int exitCode = process.waitFor(); + if (exitCode != 0) { + LOGGER.warn(String.format(" Seate e2e test %s by SkyWalking-E2E fail with exit code %d", + file.getName(), exitCode)); + } + Utils.printProcessLog(LOGGER, process); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml new file mode 100644 index 000000000..09ba9da29 --- /dev/null +++ b/e2e-test/pom.xml @@ -0,0 +1,63 @@ + + 4.0.0 + org.apache.seata + e2e-test + 2.0.0 + pom + e2e-test + + e2e-test-builder + e2e-test-runner + + + + + + com.github.docker-java + docker-java-core + 3.2.7 + + + com.github.docker-java + docker-java-transport-httpclient5 + 3.2.7 + + + org.yaml + snakeyaml + 1.32 + + + org.freemarker + freemarker + 2.3.28 + + + org.slf4j + slf4j-api + 1.7.32 + + + ch.qos.logback + logback-classic + 1.2.9 + + + org.slf4j + jcl-over-slf4j + 1.7.32 + + + org.slf4j + log4j-over-slf4j + 1.7.32 + + + commons-io + commons-io + 2.11.0 + + + + From a8e9e00dd1310b49a5a912a45e286588b2d70314 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 1 Apr 2024 22:42:42 +0800 Subject: [PATCH 02/40] fix: del compose file --- .../docker-compose.yaml | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 at-sample/springboot-dubbo-seata/docker-compose.yaml diff --git a/at-sample/springboot-dubbo-seata/docker-compose.yaml b/at-sample/springboot-dubbo-seata/docker-compose.yaml deleted file mode 100644 index 163afa922..000000000 --- a/at-sample/springboot-dubbo-seata/docker-compose.yaml +++ /dev/null @@ -1,70 +0,0 @@ -version: "3.9" -services: - account: - hostname: account - image: springboot-dubbo-seata-account:0.0.1 - restart: on-failure - depends_on: - - seata-server - - zookeeper - - mysql - business: - hostname: business - image: springboot-dubbo-seata-business:0.0.1 - restart: on-failure - depends_on: - - account - - order - - storage - order: - hostname: order - image: springboot-dubbo-seata-order:0.0.1 - restart: on-failure - depends_on: - - seata-server - - zookeeper - - mysql - storage: - hostname: storage - image: springboot-dubbo-seata-storage:0.0.1 - restart: on-failure - depends_on: - - seata-server - - zookeeper - - mysql - mysql: - hostname: businessmysql - image: mysql:5.7 - volumes: - - ./sqlsh:/docker-entrypoint-initdb.d - restart: always - environment: - MYSQL_ROOT_PASSWORD: 123456 - MYSQL_DATABASE: storage - MYSQL_USER: user - MYSQL_PASSWORD: user - # ports: - # - "3307:3306" - networks: - - host - healthcheck: - test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] - interval: 5s - timeout: 10s - retries: 10 - seata-server: - image: seataio/seata-server:${latest-release-version} - hostname: seata-server - ports: - - "7091:7091" - - "8091:8091" - environment: - - SEATA_PORT=8091 - - STORE_MODE=file - zookeeper: - hostname: zookeeper - image: zookeeper:3.7.1 - - -networks: - host: \ No newline at end of file From b1eb6f8d64babca5743bedbd5fca7f0bcf28b4bd Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 8 Apr 2024 23:05:42 +0800 Subject: [PATCH 03/40] feat: add e2e framework sh --- e2e-test/e2e-test-builder/pom.xml | 23 ++++++++++++ .../java/org/apache/seata/BuilderMain.java | 2 +- .../org/apache/seata/builder/E2EBuilder.java | 1 - .../apache/seata/builder/ImageBuilder.java | 7 +++- .../java/org/apache/seata/util/Utils.java | 3 +- e2e-test/e2e-test-runner/pom.xml | 36 +++++++++++++++++++ .../java/org/apache/seata/RunnerMain.java | 2 +- .../controller/SkyWalkingController.java | 3 +- e2e-test/pom.xml | 1 + e2e-test/scripts/prepare-test.sh | 15 ++++++++ e2e-test/scripts/prepare_skywalkingE2E.sh | 1 + e2e-test/scripts/test-run.sh | 17 +++++++++ 12 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 e2e-test/scripts/prepare-test.sh create mode 100644 e2e-test/scripts/prepare_skywalkingE2E.sh create mode 100644 e2e-test/scripts/test-run.sh diff --git a/e2e-test/e2e-test-builder/pom.xml b/e2e-test/e2e-test-builder/pom.xml index 01b3a38d8..7f822a381 100644 --- a/e2e-test/e2e-test-builder/pom.xml +++ b/e2e-test/e2e-test-builder/pom.xml @@ -52,6 +52,29 @@ 8 + + maven-assembly-plugin + 3.3.0 + + + jar-with-dependencies + + + + org.apache.seata.BuilderMain + + + + + + make-assembly + package + + single + + + + diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java index 2cb9e9148..9599d3489 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java @@ -12,7 +12,7 @@ public static void main(String[] args) throws IOException, InterruptedException E2EBuilder e2EBuilder = new E2EBuilder(); e2EBuilder.setRootPath("./"); if (args != null && args.length == 1) { - e2EBuilder.setRootPath(args[1]); + e2EBuilder.setRootPath(args[0]); } e2EBuilder.buildSeataE2ETest(); } diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java index 5009d5a36..7e02ee654 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java @@ -14,7 +14,6 @@ */ public class E2EBuilder { private String rootPath; - private static final Logger LOGGER = LoggerFactory.getLogger(E2EBuilder.class); public String getRootPath() { return rootPath; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java index 69700e6b6..7f14179f4 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java @@ -34,7 +34,12 @@ private int packageMavenParentModule(File moduleDir) throws IOException, Interru LOGGER.info("Packaging Maven module: " + moduleDir.getPath()); ProcessBuilder builder = new ProcessBuilder(); builder.directory(moduleDir); - builder.command("mvn.cmd", "clean", "package"); +// builder.command("mvn.cmd", "clean", "package"); + if (System.getProperty("os.name").contains("Windows")) { + builder.command("mvn.cmd", "clean", "package"); + } else { + builder.command("mvn", "clean", "package"); + } Process process = builder.start(); Utils.printProcessLog(LOGGER, process); int exitCode = process.waitFor(); diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java index f2f13f6bc..770a35126 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java @@ -14,8 +14,7 @@ public class Utils { public static void printProcessLog(Logger LOGGER, Process process) { ExecutorService executor = Executors.newFixedThreadPool(2); - - // 分别为标准输出和错误输出创建并启动线程 + executor.submit(() -> printStream(LOGGER, process.getInputStream(), false)); executor.submit(() -> printStream(LOGGER, process.getErrorStream(), true)); diff --git a/e2e-test/e2e-test-runner/pom.xml b/e2e-test/e2e-test-runner/pom.xml index b0fb7c194..7c8ba2fe1 100644 --- a/e2e-test/e2e-test-runner/pom.xml +++ b/e2e-test/e2e-test-runner/pom.xml @@ -18,4 +18,40 @@ 2.0.0 + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + maven-assembly-plugin + 3.3.0 + + + jar-with-dependencies + + + + org.apache.seata.RunnerMain + + + + + + make-assembly + package + + single + + + + + + diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java index a57a72ff2..6a9aea075 100644 --- a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java @@ -13,7 +13,7 @@ public static void main(String[] args) throws IOException, InterruptedException SkyWalkingController skyWalkingController = new SkyWalkingController(); skyWalkingController.setE2eDir(ConfigConstants.SCENE_DIR); if (args != null && args.length == 1) { - skyWalkingController.setE2eDir(args[1]); + skyWalkingController.setE2eDir(args[0]); } skyWalkingController.runE2ETests(); } 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 ec70cf0a5..57ff428d9 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 @@ -1,6 +1,5 @@ package org.apache.seata.controller; -import org.apache.seata.generator.DockerComposeGenerator; import org.apache.seata.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,12 +31,12 @@ public void runE2ETests() { builder.directory(file); builder.command("e2e", "run"); Process process = builder.start(); + Utils.printProcessLog(LOGGER, process); int exitCode = process.waitFor(); if (exitCode != 0) { LOGGER.warn(String.format(" Seate e2e test %s by SkyWalking-E2E fail with exit code %d", file.getName(), exitCode)); } - Utils.printProcessLog(LOGGER, process); } catch (Exception e) { e.printStackTrace(); } diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index 09ba9da29..b963a0633 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -60,4 +60,5 @@ + diff --git a/e2e-test/scripts/prepare-test.sh b/e2e-test/scripts/prepare-test.sh new file mode 100644 index 000000000..5b5f14775 --- /dev/null +++ b/e2e-test/scripts/prepare-test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_DIR="$(dirname "$DIR")" +PROJECT_DIR="$(dirname "$(dirname "$DIR")")" +cd $TEST_DIR/e2e-test-builder +mvn clean install -DskipTests +result=$? +if [ $result -ne 0 ]; then + echo "Build seata e2e-test-builder failure" + exit $result +fi +cd $PROJECT_DIR +cp $TEST_DIR/e2e-test-builder/target/e2e-test-builder-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-builder.jar +java -jar ./e2e-test-builder.jar ./ \ No newline at end of file diff --git a/e2e-test/scripts/prepare_skywalkingE2E.sh b/e2e-test/scripts/prepare_skywalkingE2E.sh new file mode 100644 index 000000000..43a8d282a --- /dev/null +++ b/e2e-test/scripts/prepare_skywalkingE2E.sh @@ -0,0 +1 @@ +go install github.com/apache/skywalking-infra-e2e/cmd/e2e@latest \ No newline at end of file diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh new file mode 100644 index 000000000..9f1110a6d --- /dev/null +++ b/e2e-test/scripts/test-run.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_DIR="$(dirname "$DIR")" +PROJECT_DIR="$(dirname "$(dirname "$DIR")")" +cd $TEST_DIR +mvn clean package -DskipTests +cd $TEST_DIR/e2e-test-runner +mvn clean package -DskipTests +result=$? +if [ $result -ne 0 ]; then + echo "Build seata e2e-test-runner failure" + exit $result +fi +cd $PROJECT_DIR +cp $TEST_DIR/e2e-test-runner/target/e2e-test-runner-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-runner.jar +java -jar ./e2e-test-runner.jar ./tmp/scene-test \ No newline at end of file From aa598111ae6ebcc811f04570f2d980eb5bde3662 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 15 Apr 2024 22:49:03 +0800 Subject: [PATCH 04/40] feat: add e2e demo in network --- .github/workflows/E2E.yml | 46 ++++++- .../springboot-dubbo-seata/seata-e2e.yaml | 43 ++++-- .../src/main/resources/application.properties | 11 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- .../src/main/resources/application.properties | 7 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- .../src/main/resources/application.properties | 11 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- .../src/main/resources/application.properties | 11 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- 14 files changed, 103 insertions(+), 1026 deletions(-) delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 261df6c95..4c1d346c1 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: "E2E Test" on: push: @@ -18,4 +18,46 @@ on: # The branches below must be a subset of the branches above branches: [ e2e-demo ] # -#jobs: \ No newline at end of file +jobs: + prepareE2EFramework: + name: E2E Test Prepare + runs-on: ubuntu-latest + steps: + - name: Clone skywalking e2e repository + run: git clone https://github.com/apache/skywalking-infra-e2e.git skywalking-infra-e2e + + - name: Navigate to cloned repository + run: cd skywalking-infra-e2e + + - name: Set up Go 1.18 + uses: actions/setup-go@v4 + with: + go-version: 1.18 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Build e2e framework + run: make linux + + - name: Set current path as environment variable + run: | + echo "export CURRENT_PATH=$(pwd)" >> $GITHUB_ENV + + prepareE2ETest: + name: Prepare E2E Test + runs-on: ubuntu-latest + steps: + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 8 + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Run e2e tests + run: | + cd e2e-test/scripts && bash prepare-test.sh \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml index 800d82183..7facb8b37 100644 --- a/at-sample/springboot-dubbo-seata/seata-e2e.yaml +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -1,8 +1,5 @@ e2e: scene_name: at-springboot-dubbo-seata - # 后期考虑扩展成通用基础设施一键配置 - inherit: - name: at-common # retry config retry: max: 5 @@ -17,7 +14,7 @@ e2e: # 这里可以加一些插件实现不同功能 # docker service 下的参数,这样写是为了方便后续扩展解耦 docker_service: - network_mode: host + hostname: springboot-dubbo-seata-business restart: on-failure container_name: test depends_on: @@ -27,40 +24,56 @@ e2e: condition: service_started springboot-dubbo-seata-order: condition: service_started + environment: + zookeeper.address: zookeeper + seata.address: seata providers: - name: springboot-dubbo-seata-account docker_service: - network_mode: host + hostname: springboot-dubbo-seata-account restart: on-failure depends_on: zookeeper: condition: service_healthy mysql: condition: service_healthy + environment: + zookeeper.address: zookeeper + mysql.address: mysqlAddress + seata.address: seata - name: springboot-dubbo-seata-order docker_service: - network_mode: host + hostname: springboot-dubbo-seata-order restart: on-failure depends_on: zookeeper: condition: service_healthy mysql: condition: service_healthy + environment: + zookeeper.address: zookeeper + mysql.address: mysqlAddress + seata.address: seata - name: springboot-dubbo-seata-storage docker_service: - network_mode: host + hostname: springboot-dubbo-seata-order restart: on-failure depends_on: zookeeper: condition: service_healthy mysql: condition: service_healthy + environment: + zookeeper.address: zookeeper + mysql.address: mysqlAddress + seata.address: seata infrastructures: - name: mysql docker_service: + hostname: mysqlAddress image: mysql:5.7 - ports: - - "3307:3306" +# ports: +# - "3307:3306" volumes: - ./e2e-files/sqlsh:/docker-entrypoint-initdb.d restart: always @@ -76,18 +89,20 @@ e2e: retries: 10 - name: seata-server docker_service: + hostname: seata image: seataio/seata-server:2.0.0 - ports: - - "7091:7091" - - "8091:8091" +# ports: +# - "7091:7091" +# - "8091:8091" environment: SEATA_PORT: 8091 STORE_MODE: file - name: zookeeper docker_service: + hostname: zookeeper image: zookeeper:3.5.7 - ports: - - "2181:2181" +# ports: +# - "2181:2181" healthcheck: test: '[ "CMD", "echo", "ruok", "|", "nc", "localhost", "2181", "|", "grep", "imok" ]' interval: 30s diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties index 39682daf4..8593a4839 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties @@ -1,12 +1,17 @@ spring.application.name=springboot-dubbo-seata-account spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF8 -spring.datasource.username=root +spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata??useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-account seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=28801 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties index f220ff15b..32fc1f64e 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties @@ -1,9 +1,14 @@ spring.application.name=springboot-dubbo-seata-business seata.application-id=springboot-dubbo-seata-business seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.application.qos-enable=false dubbo.scan.base-packages=org.apache.seata -dubbo.registry.address=zookeeper://127.0.0.1:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20883 server.port=9991 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties index 6fadd4f74..cf7aa9ad4 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties @@ -1,12 +1,17 @@ spring.application.name=springboot-dubbo-seata-order spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF8 -spring.datasource.username=root +spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-order seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20883 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties index 989de1d7c..48ce97f5f 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties @@ -1,12 +1,17 @@ spring.application.name=springboot-dubbo-seata-storage spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF8 -spring.datasource.username=root +spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-storage seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20882 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} From ba0b3f36af5d312898ec0fc5af75a4719ab3d68a Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 15 Apr 2024 22:59:16 +0800 Subject: [PATCH 05/40] feat: fix e2e action --- .github/workflows/E2E.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 4c1d346c1..c0e74084e 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -13,10 +13,10 @@ name: "E2E Test" on: push: - branches: [ e2e-demo ] + branches: [ master ] pull_request: # The branches below must be a subset of the branches above - branches: [ e2e-demo ] + branches: [ master ] # jobs: prepareE2EFramework: From 74f92ee3ee7094d5b5521840812d3f2b6d85eac1 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 16:19:19 +0800 Subject: [PATCH 06/40] feat: fix e2e action --- .github/workflows/E2E.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index c0e74084e..8106b4449 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -13,10 +13,10 @@ name: "E2E Test" on: push: - branches: [ master ] + branches: [ e2e-demo ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ e2e-demo ] # jobs: prepareE2EFramework: @@ -35,9 +35,6 @@ jobs: go-version: 1.18 id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - name: Build e2e framework run: make linux From fedf76659ea1e498a01192d36ff4480e28df3599 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 16:42:26 +0800 Subject: [PATCH 07/40] feat: fix e2e action --- .github/workflows/E2E.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 8106b4449..2223f8e57 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -36,14 +36,17 @@ jobs: id: go - name: Build e2e framework - run: make linux + run: | + pwd + ls + make linux - name: Set current path as environment variable run: | echo "export CURRENT_PATH=$(pwd)" >> $GITHUB_ENV - prepareE2ETest: - name: Prepare E2E Test + RunE2ETest: + name: Run Seata E2E Test runs-on: ubuntu-latest steps: - name: Set up JDK 8 @@ -55,6 +58,10 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v3 - - name: Run e2e tests + - name: prepare e2e tests run: | - cd e2e-test/scripts && bash prepare-test.sh \ No newline at end of file + cd e2e-test/scripts && bash prepare-test.sh + + - name: run e2e tests + run: | + bash test-run.sh \ No newline at end of file From ca1acfc27d4446f68408acb5a2510ab8080eebd5 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 17:04:28 +0800 Subject: [PATCH 08/40] feat: fix e2e action --- .github/workflows/E2E.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 2223f8e57..f548c9afb 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -26,9 +26,6 @@ jobs: - name: Clone skywalking e2e repository run: git clone https://github.com/apache/skywalking-infra-e2e.git skywalking-infra-e2e - - name: Navigate to cloned repository - run: cd skywalking-infra-e2e - - name: Set up Go 1.18 uses: actions/setup-go@v4 with: @@ -37,9 +34,7 @@ jobs: - name: Build e2e framework run: | - pwd - ls - make linux + cd skywalking-infra-e2e && make linux - name: Set current path as environment variable run: | @@ -64,4 +59,4 @@ jobs: - name: run e2e tests run: | - bash test-run.sh \ No newline at end of file + cd e2e-test/scripts && bash test-run.sh \ No newline at end of file From a26085d8741d47739e420a105fb476ba03bc7a50 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 17:19:49 +0800 Subject: [PATCH 09/40] feat: fix e2e action --- .github/workflows/E2E.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index f548c9afb..cb3781ac5 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -23,6 +23,9 @@ jobs: name: E2E Test Prepare runs-on: ubuntu-latest steps: + - name: Check out code into + uses: actions/checkout@v3 + - name: Clone skywalking e2e repository run: git clone https://github.com/apache/skywalking-infra-e2e.git skywalking-infra-e2e @@ -50,7 +53,7 @@ jobs: distribution: 'zulu' java-version: 8 - - name: Check out code into the Go module directory + - name: Check out code uses: actions/checkout@v3 - name: prepare e2e tests From 7b548bcc031a608c3f3e36ee6b5a5cc5c07b4717 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 20:00:16 +0800 Subject: [PATCH 10/40] feat: fix e2e action --- .github/workflows/E2E.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index cb3781ac5..12cf872f5 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -19,7 +19,7 @@ on: branches: [ e2e-demo ] # jobs: - prepareE2EFramework: + run_e2e: name: E2E Test Prepare runs-on: ubuntu-latest steps: @@ -41,25 +41,14 @@ jobs: - name: Set current path as environment variable run: | - echo "export CURRENT_PATH=$(pwd)" >> $GITHUB_ENV + cd skywalking-infra-e2e && echo "export CURRENT_PATH=$(pwd)" >> $GITHUB_ENV - RunE2ETest: - name: Run Seata E2E Test - runs-on: ubuntu-latest - steps: - name: Set up JDK 8 uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 8 - - name: Check out code - uses: actions/checkout@v3 - - - name: prepare e2e tests + - name: prepare and run e2e tests run: | - cd e2e-test/scripts && bash prepare-test.sh - - - name: run e2e tests - run: | - cd e2e-test/scripts && bash test-run.sh \ No newline at end of file + cd e2e-test/scripts && sh prepare-test.sh && sh test-run.sh \ No newline at end of file From d718d0e79aef94b3ae0cbe35cd20aa9254f96ee6 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 20:14:05 +0800 Subject: [PATCH 11/40] feat: fix e2e action --- .github/workflows/E2E.yml | 2 +- e2e-test/scripts/prepare-test.sh | 4 +++- e2e-test/scripts/test-run.sh | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 12cf872f5..db9431515 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -20,7 +20,7 @@ on: # jobs: run_e2e: - name: E2E Test Prepare + name: Run E2E Test runs-on: ubuntu-latest steps: - name: Check out code into diff --git a/e2e-test/scripts/prepare-test.sh b/e2e-test/scripts/prepare-test.sh index 5b5f14775..a0d8589d3 100644 --- a/e2e-test/scripts/prepare-test.sh +++ b/e2e-test/scripts/prepare-test.sh @@ -1,5 +1,6 @@ #!/bin/bash +echo "start prepare Seata e2e test scene" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TEST_DIR="$(dirname "$DIR")" PROJECT_DIR="$(dirname "$(dirname "$DIR")")" @@ -12,4 +13,5 @@ if [ $result -ne 0 ]; then fi cd $PROJECT_DIR cp $TEST_DIR/e2e-test-builder/target/e2e-test-builder-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-builder.jar -java -jar ./e2e-test-builder.jar ./ \ No newline at end of file +java -jar ./e2e-test-builder.jar ./ +echo "finish prepare Seata e2e test scene" \ No newline at end of file diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh index 9f1110a6d..d862d5b5d 100644 --- a/e2e-test/scripts/test-run.sh +++ b/e2e-test/scripts/test-run.sh @@ -1,10 +1,16 @@ #!/bin/bash +echo "start run Seata e2e test scene" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TEST_DIR="$(dirname "$DIR")" PROJECT_DIR="$(dirname "$(dirname "$DIR")")" cd $TEST_DIR mvn clean package -DskipTests +result=$? +if [ $result -ne 0 ]; then + echo "Build seata e2e-test failure" + exit $result +fi cd $TEST_DIR/e2e-test-runner mvn clean package -DskipTests result=$? @@ -14,4 +20,5 @@ if [ $result -ne 0 ]; then fi cd $PROJECT_DIR cp $TEST_DIR/e2e-test-runner/target/e2e-test-runner-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-runner.jar -java -jar ./e2e-test-runner.jar ./tmp/scene-test \ No newline at end of file +java -jar ./e2e-test-runner.jar ./tmp/scene-test +echo "finish run Seata e2e test scene" \ No newline at end of file From b73a355c8392e20bbde093b5388ccb5e353a9354 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 20:25:12 +0800 Subject: [PATCH 12/40] feat: fix e2e action --- .github/workflows/E2E.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index db9431515..ee795e541 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -49,6 +49,11 @@ jobs: distribution: 'zulu' java-version: 8 + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + - name: prepare and run e2e tests run: | cd e2e-test/scripts && sh prepare-test.sh && sh test-run.sh \ No newline at end of file From 588ce402d72a15b2a5e7e545f1e655e4bf54b8c7 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 20:31:42 +0800 Subject: [PATCH 13/40] feat: fix e2e action --- e2e-test/scripts/test-run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh index d862d5b5d..3df1de0cd 100644 --- a/e2e-test/scripts/test-run.sh +++ b/e2e-test/scripts/test-run.sh @@ -5,14 +5,14 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TEST_DIR="$(dirname "$DIR")" PROJECT_DIR="$(dirname "$(dirname "$DIR")")" cd $TEST_DIR -mvn clean package -DskipTests +mvn clean install -DskipTests result=$? if [ $result -ne 0 ]; then echo "Build seata e2e-test failure" exit $result fi cd $TEST_DIR/e2e-test-runner -mvn clean package -DskipTests +mvn clean install -DskipTests result=$? if [ $result -ne 0 ]; then echo "Build seata e2e-test-runner failure" From 1bd4f8d5bc676d8e704facd69674d8a04277834d Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 20:40:21 +0800 Subject: [PATCH 14/40] feat: fix e2e action --- e2e-test/scripts/test-run.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh index 3df1de0cd..02f2b9f4b 100644 --- a/e2e-test/scripts/test-run.sh +++ b/e2e-test/scripts/test-run.sh @@ -20,5 +20,11 @@ if [ $result -ne 0 ]; then fi cd $PROJECT_DIR cp $TEST_DIR/e2e-test-runner/target/e2e-test-runner-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-runner.jar -java -jar ./e2e-test-runner.jar ./tmp/scene-test +echo "start run seata test by skywalking e2e framework" +pwd +java -jar ./e2e-test-runner.jar ./ +if [ $result -ne 0 ]; then + echo "run seata e2e-test-runner failure" + exit $result +fi echo "finish run Seata e2e test scene" \ No newline at end of file From 48f1261ad668a6d35d819b3b3251b98559806f47 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 20:49:09 +0800 Subject: [PATCH 15/40] feat: fix e2e action --- .github/workflows/E2E.yml | 5 ----- .../org/apache/seata/controller/SkyWalkingController.java | 1 + e2e-test/scripts/test-run.sh | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index ee795e541..db9431515 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -49,11 +49,6 @@ jobs: distribution: 'zulu' java-version: 8 - - name: Cache local Maven repository - uses: actions/cache@v3 - with: - path: ~/.m2/repository - - name: prepare and run e2e tests run: | cd e2e-test/scripts && sh prepare-test.sh && sh test-run.sh \ No newline at end of file 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 57ff428d9..2b567153b 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 @@ -38,6 +38,7 @@ public void runE2ETests() { file.getName(), exitCode)); } } catch (Exception e) { + LOGGER.error("Running Seate e2e test by SkyWalking-E2E fail in: " + file.getPath()); e.printStackTrace(); } } diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh index 02f2b9f4b..f79fcfbbd 100644 --- a/e2e-test/scripts/test-run.sh +++ b/e2e-test/scripts/test-run.sh @@ -22,7 +22,7 @@ cd $PROJECT_DIR cp $TEST_DIR/e2e-test-runner/target/e2e-test-runner-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-runner.jar echo "start run seata test by skywalking e2e framework" pwd -java -jar ./e2e-test-runner.jar ./ +java -jar ./e2e-test-runner.jar ./tmp/scene-test if [ $result -ne 0 ]; then echo "run seata e2e-test-runner failure" exit $result From 04d5d2341870590b9b7d81eb0c7cb7e22af6fd85 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 21:02:01 +0800 Subject: [PATCH 16/40] feat: fix e2e action --- .github/workflows/E2E.yml | 10 +++++++--- .../apache/seata/controller/SkyWalkingController.java | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index db9431515..b30f186cc 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -39,9 +39,12 @@ jobs: run: | cd skywalking-infra-e2e && make linux - - name: Set current path as environment variable + - name: Add script directory to PATH run: | - cd skywalking-infra-e2e && echo "export CURRENT_PATH=$(pwd)" >> $GITHUB_ENV + cd skywalking-infra-e2e + pwd + ls + echo "export PATH=\$PATH:$(pwd)" >> $GITHUB_PATH - name: Set up JDK 8 uses: actions/setup-java@v3 @@ -51,4 +54,5 @@ jobs: - name: prepare and run e2e tests run: | - cd e2e-test/scripts && sh prepare-test.sh && sh test-run.sh \ No newline at end of file + cd e2e-test/scripts && sh prepare-test.sh && sh test-run.sh + echo $PATH \ No newline at end of file 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 2b567153b..10793f6cd 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 @@ -38,7 +38,7 @@ public void runE2ETests() { file.getName(), exitCode)); } } catch (Exception e) { - LOGGER.error("Running Seate e2e test by SkyWalking-E2E fail in: " + file.getPath()); + LOGGER.error("Running Seate e2e test by SkyWalking-E2E fail in: " + file.getAbsolutePath()); e.printStackTrace(); } } From e39cb30b70a0bf2b16d04c959412de4150e82e57 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 21:48:42 +0800 Subject: [PATCH 17/40] feat: fix e2e action --- .github/workflows/E2E.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index b30f186cc..63129a27b 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -41,10 +41,10 @@ jobs: - name: Add script directory to PATH run: | - cd skywalking-infra-e2e + cd skywalking-infra-e2e/bin pwd ls - echo "export PATH=\$PATH:$(pwd)" >> $GITHUB_PATH + echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH - name: Set up JDK 8 uses: actions/setup-java@v3 From aa9239d605624bad2e86fc174286fd7d0316791b Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 21:54:09 +0800 Subject: [PATCH 18/40] feat: fix e2e action --- .github/workflows/E2E.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 63129a27b..feb102664 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -45,6 +45,8 @@ jobs: pwd ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH + mv linux e2e + e2e - name: Set up JDK 8 uses: actions/setup-java@v3 From 13da4b2e267f7b350a3d5d7581a3b79fddf06dab Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 22:27:46 +0800 Subject: [PATCH 19/40] feat: fix e2e action --- .github/workflows/E2E.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index feb102664..ffb7e403b 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -46,6 +46,7 @@ jobs: ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH mv linux e2e + chmod e2e 777 e2e - name: Set up JDK 8 From f08711b639d0cd6f1debb1fb81c34da26dc4146a Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 22:29:15 +0800 Subject: [PATCH 20/40] feat: fix e2e action --- .github/workflows/E2E.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index ffb7e403b..1f1c31de0 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -46,7 +46,7 @@ jobs: ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH mv linux e2e - chmod e2e 777 + chmod 777 e2e e2e - name: Set up JDK 8 From 9b0272792bbdd8718a429590dc78adb194967f77 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 22:47:28 +0800 Subject: [PATCH 21/40] feat: fix e2e action --- .github/workflows/E2E.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 1f1c31de0..e8a4e76b9 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -45,8 +45,9 @@ jobs: pwd ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH + source ~/.bashrc mv linux e2e - chmod 777 e2e + ls e2e - name: Set up JDK 8 From f4f578dd863236a364f5fbad17aaa04a3eb3a249 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 22:53:01 +0800 Subject: [PATCH 22/40] feat: fix e2e action --- .github/workflows/E2E.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index e8a4e76b9..98aae57dd 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -48,7 +48,7 @@ jobs: source ~/.bashrc mv linux e2e ls - e2e + ./e2e - name: Set up JDK 8 uses: actions/setup-java@v3 From 2c2a0b40533cf468e3a9cbdcdcc98385af6881cc Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 22:53:20 +0800 Subject: [PATCH 23/40] feat: fix e2e action --- .github/workflows/E2E.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 98aae57dd..672dc5f94 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -48,6 +48,7 @@ jobs: source ~/.bashrc mv linux e2e ls + chmod 777 e2e ./e2e - name: Set up JDK 8 From 82beaa23bd434c503ef39edbf91fc92a3c30cc6f Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 22:55:56 +0800 Subject: [PATCH 24/40] feat: fix e2e action --- .github/workflows/E2E.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 672dc5f94..ae9b0829c 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -41,15 +41,15 @@ jobs: - name: Add script directory to PATH run: | - cd skywalking-infra-e2e/bin + cd skywalking-infra-e2e/bin/linux pwd ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH - source ~/.bashrc - mv linux e2e - ls +# source ~/.bashrc +# mv linux e2e +# ls chmod 777 e2e - ./e2e + e2e - name: Set up JDK 8 uses: actions/setup-java@v3 From 7405233bc3b283d36feb924073c571465abd25f9 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 23:00:06 +0800 Subject: [PATCH 25/40] feat: fix e2e action --- .github/workflows/E2E.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index ae9b0829c..7421fb6e6 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -45,9 +45,6 @@ jobs: pwd ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH -# source ~/.bashrc -# mv linux e2e -# ls chmod 777 e2e e2e From f2aba59aa7ed1ecbc3a9ea475a1d1dbeac22b661 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 23:03:02 +0800 Subject: [PATCH 26/40] feat: fix e2e action --- .github/workflows/E2E.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 7421fb6e6..002e4f826 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -46,7 +46,7 @@ jobs: ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH chmod 777 e2e - e2e + ./e2e - name: Set up JDK 8 uses: actions/setup-java@v3 From 4d8784ff2715362fc7b8df0a5e3d5e32c2b45302 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 23:05:12 +0800 Subject: [PATCH 27/40] feat: fix e2e action --- .github/workflows/E2E.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 002e4f826..116f7c137 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -46,7 +46,7 @@ jobs: ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH chmod 777 e2e - ./e2e + cp e2e /usr/local/bin - name: Set up JDK 8 uses: actions/setup-java@v3 From 38380d2af98c4f35559fa25c100e92b6a1c2b0eb Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Tue, 16 Apr 2024 23:10:59 +0800 Subject: [PATCH 28/40] feat: fix e2e action --- .../src/main/resources/template/jar-dockerFile.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl index 75d032f6e..f4c17170c 100644 --- a/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl +++ b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl @@ -1,3 +1,3 @@ -FROM java:8 +FROM openjdk:8-jdk-alpine COPY ${sourceJar} /app.jar ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file From 873def4f5382a3e6417b88c586881fe0468fc637 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Wed, 17 Apr 2024 22:08:43 +0800 Subject: [PATCH 29/40] feat: fix e2e action --- .../src/main/resources/template/jar-dockerFile.ftl | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl index f4c17170c..eadaee584 100644 --- a/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl +++ b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl @@ -1,3 +1,4 @@ FROM openjdk:8-jdk-alpine +RUN apk --no-cache add curl COPY ${sourceJar} /app.jar ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file From 0c2dc46b0a9ef23c2debc27571622b192ea1d11f Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 20 Apr 2024 11:41:07 +0800 Subject: [PATCH 30/40] feat: fix e2e action --- .github/workflows/E2E.yml | 16 +++++++++++----- e2e-test/scripts/test-run.sh | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 116f7c137..58a62048f 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -42,8 +42,6 @@ jobs: - name: Add script directory to PATH run: | cd skywalking-infra-e2e/bin/linux - pwd - ls echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH chmod 777 e2e cp e2e /usr/local/bin @@ -54,7 +52,15 @@ jobs: distribution: 'zulu' java-version: 8 - - name: prepare and run e2e tests + - name: prepare e2e tests run: | - cd e2e-test/scripts && sh prepare-test.sh && sh test-run.sh - echo $PATH \ No newline at end of file + cd e2e-test/scripts && sh prepare-test.sh + + - name: run e2e tests + run: | + cd e2e-test/scripts && sh test-run.sh + result=$? + if [ $result -ne 0 ]; then + echo "run seata e2e-test-runner failure" + exit $result + fi diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh index f79fcfbbd..3b46ec505 100644 --- a/e2e-test/scripts/test-run.sh +++ b/e2e-test/scripts/test-run.sh @@ -23,6 +23,7 @@ cp $TEST_DIR/e2e-test-runner/target/e2e-test-runner-*-jar-with-dependencies.jar echo "start run seata test by skywalking e2e framework" pwd java -jar ./e2e-test-runner.jar ./tmp/scene-test +result=$? if [ $result -ne 0 ]; then echo "run seata e2e-test-runner failure" exit $result From 26ef0861a1b9f2e90a2363fab3958cffbee06630 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 20 Apr 2024 11:44:59 +0800 Subject: [PATCH 31/40] feat: fix e2e action --- at-sample/springboot-dubbo-seata/e2e-files/expected.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml index 946b0e70c..63e6732e3 100644 --- a/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml +++ b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml @@ -1 +1 @@ -{"res": "success"} \ No newline at end of file +{"res": "succes"} \ No newline at end of file From 6df75b76228ac064cee46d64d2306e7eb14979fa Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 20 Apr 2024 12:23:32 +0800 Subject: [PATCH 32/40] feat: fix e2e action --- .github/workflows/E2E.yml | 10 +++---- .../e2e-files/commit.yaml | 1 + .../e2e-files/expected.yaml | 1 - .../e2e-files/rollback.yaml | 1 + .../springboot-dubbo-seata/seata-e2e.yaml | 10 +++++-- .../org/apache/seata/e2e/E2EController.java | 28 +++++++++++++------ .../apache/seata/service/BusinessService.java | 13 +++++++-- .../service/impl/BusinessServiceImpl.java | 19 ++++++++++--- 8 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 at-sample/springboot-dubbo-seata/e2e-files/commit.yaml delete mode 100644 at-sample/springboot-dubbo-seata/e2e-files/expected.yaml create mode 100644 at-sample/springboot-dubbo-seata/e2e-files/rollback.yaml diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 58a62048f..47021ca82 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -58,9 +58,9 @@ jobs: - name: run e2e tests run: | - cd e2e-test/scripts && sh test-run.sh - result=$? - if [ $result -ne 0 ]; then - echo "run seata e2e-test-runner failure" - exit $result + cd e2e-test/scripts + sh test-run.sh | tee -a e2e.log + if grep -q "ERROR failed to verify" e2e.log; then + echo "failed to verify in e2e tests" + exit 1 fi diff --git a/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml b/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml new file mode 100644 index 000000000..5aed33a4e --- /dev/null +++ b/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml @@ -0,0 +1 @@ +{"res": "commit"} \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml deleted file mode 100644 index 63e6732e3..000000000 --- a/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml +++ /dev/null @@ -1 +0,0 @@ -{"res": "succes"} \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/e2e-files/rollback.yaml b/at-sample/springboot-dubbo-seata/e2e-files/rollback.yaml new file mode 100644 index 000000000..635f7b83a --- /dev/null +++ b/at-sample/springboot-dubbo-seata/e2e-files/rollback.yaml @@ -0,0 +1 @@ +{"res": "rollback"} \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml index 7facb8b37..5be252732 100644 --- a/at-sample/springboot-dubbo-seata/seata-e2e.yaml +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -110,6 +110,10 @@ e2e: retries: 3 cases: - - name: normal test - invoke: 'docker exec test curl http://127.0.0.1:9991/testCreate' - verify: './e2e-files/expected.yaml' \ No newline at end of file + - name: rollback test + invoke: 'docker exec test curl http://127.0.0.1:9991/testRollback' + verify: './e2e-files/rollback.yaml' + + - name: commit test + invoke: 'docker exec test curl http://127.0.0.1:9991/testCommit' + verify: './e2e-files/commit.yaml' \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java index 83e179d80..405f754a8 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java @@ -1,12 +1,8 @@ package org.apache.seata.e2e; -import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.seata.service.BusinessService; -import org.apache.seata.service.OrderService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.yaml.snakeyaml.Yaml; @@ -23,8 +19,8 @@ public class E2EController { @Autowired private BusinessService businessService; - @GetMapping("testCreate") - public void testCreate(HttpServletResponse response) throws IOException { + @GetMapping("testRollback") + public void testRollback(HttpServletResponse response) throws IOException { Map res = new HashMap<>(); // 设置响应类型 response.setContentType("text/yaml"); @@ -32,15 +28,29 @@ public void testCreate(HttpServletResponse response) throws IOException { Yaml yaml = new Yaml(); try { - businessService.purchase("U100001", "C00321", 2); + businessService.purchaseRollback("U100001", "C00321", 2); } catch (Exception e) { e.printStackTrace(); - res.put("res", "failed"); + res.put("res", "rollback"); String yamlStr = yaml.dump(res); response.getWriter().write(yamlStr); return; } - res.put("res", "success"); + res.put("res", "commit"); + String yamlStr = yaml.dump(res); + response.getWriter().write(yamlStr); + } + + @GetMapping("testCommit") + public void testCommit(HttpServletResponse response) throws IOException { + Map res = new HashMap<>(); + // 设置响应类型 + response.setContentType("text/yaml"); + response.setCharacterEncoding("UTF-8"); + + Yaml yaml = new Yaml(); + businessService.purchaseCommit("U100001", "C00321", 2); + res.put("res", "commit"); String yamlStr = yaml.dump(res); response.getWriter().write(yamlStr); } diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/BusinessService.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/BusinessService.java index c6f16f415..0b310bd8d 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/BusinessService.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/BusinessService.java @@ -22,11 +22,20 @@ public interface BusinessService { /** - * 用户订购商品 + * 用户订购商品回滚 * * @param userId 用户ID * @param commodityCode 商品编号 * @param orderCount 订购数量 */ - void purchase(String userId, String commodityCode, int orderCount); + void purchaseRollback(String userId, String commodityCode, int orderCount); + + /** + * 用户订购商品成功 + * + * @param userId 用户ID + * @param commodityCode 商品编号 + * @param orderCount 订购数量 + */ + void purchaseCommit(String userId, String commodityCode, int orderCount); } diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/impl/BusinessServiceImpl.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/impl/BusinessServiceImpl.java index e6e374099..eed6826b6 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/impl/BusinessServiceImpl.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/service/impl/BusinessServiceImpl.java @@ -41,14 +41,25 @@ public class BusinessServiceImpl implements BusinessService { @Override @GlobalTransactional(timeoutMills = 300000, name = "spring-dubbo-tx") - public void purchase(String userId, String commodityCode, int orderCount) { + public void purchaseRollback(String userId, String commodityCode, int orderCount) { + LOGGER.info("purchase begin ... xid: " + RootContext.getXID()); + storageService.deduct(commodityCode, orderCount); + // just test batch update + //stockService.batchDeduct(commodityCode, orderCount); + orderService.create(userId, commodityCode, orderCount); +// if (random.nextBoolean()) { +// throw new RuntimeException("random exception mock!"); +// } + throw new RuntimeException("random exception mock!"); + } + + @Override + @GlobalTransactional(timeoutMills = 300000, name = "spring-dubbo-tx") + public void purchaseCommit(String userId, String commodityCode, int orderCount) { LOGGER.info("purchase begin ... xid: " + RootContext.getXID()); storageService.deduct(commodityCode, orderCount); // just test batch update //stockService.batchDeduct(commodityCode, orderCount); orderService.create(userId, commodityCode, orderCount); - if (random.nextBoolean()) { - throw new RuntimeException("random exception mock!"); - } } } \ No newline at end of file From 1120d728c201d9f5906f661a90fd1e040a7a697c Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 20 Apr 2024 12:34:03 +0800 Subject: [PATCH 33/40] feat: fix e2e action --- at-sample/springboot-dubbo-seata/e2e-files/commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml b/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml index 5aed33a4e..e03aa635a 100644 --- a/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml +++ b/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml @@ -1 +1 @@ -{"res": "commit"} \ No newline at end of file +{"res": "commi"} \ No newline at end of file From 5e8777c2234c138c3f7cabdd790510299afd0713 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 20 Apr 2024 13:05:59 +0800 Subject: [PATCH 34/40] feat: fix e2e action --- .github/workflows/E2E.yml | 10 +++++----- .../apache/seata/controller/SkyWalkingController.java | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 47021ca82..809cb32bc 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -59,8 +59,8 @@ jobs: - name: run e2e tests run: | cd e2e-test/scripts - sh test-run.sh | tee -a e2e.log - if grep -q "ERROR failed to verify" e2e.log; then - echo "failed to verify in e2e tests" - exit 1 - fi + sh test-run.sh +# if grep -q "ERROR failed to verify" e2e.log; then +# echo "failed to verify in e2e tests" +# exit 1 +# fi 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 10793f6cd..9dce248d3 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 @@ -36,6 +36,7 @@ public void runE2ETests() { if (exitCode != 0) { LOGGER.warn(String.format(" Seate e2e test %s by SkyWalking-E2E fail with exit code %d", file.getName(), exitCode)); + System.exit(exitCode); } } catch (Exception e) { LOGGER.error("Running Seate e2e test by SkyWalking-E2E fail in: " + file.getAbsolutePath()); From 9b79c6d2745909109520b8411e4d2561c72c09b4 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sun, 21 Apr 2024 00:04:09 +0800 Subject: [PATCH 35/40] feat: fix e2e action --- .github/workflows/E2E.yml | 30 ++++++------- .../e2e-files/commit.yaml | 2 +- .../springboot-dubbo-seata/seata-e2e.yaml | 14 +++--- e2e-test/README-CN.md | 41 +++++++++++++++++ e2e-test/README-EN.md | 45 +++++++++++++++++++ 5 files changed, 109 insertions(+), 23 deletions(-) create mode 100644 e2e-test/README-CN.md create mode 100644 e2e-test/README-EN.md diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 809cb32bc..6f362bbe0 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -11,17 +11,18 @@ # name: "E2E Test" -on: - push: - branches: [ e2e-demo ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ e2e-demo ] -# +on: [ push,pull_request ] + jobs: run_e2e: - name: Run E2E Test - runs-on: ubuntu-latest + name: Run E2E Test ${{ matrix.java }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest ] + java: [ 8, 11 ] + fail-fast: false + max-parallel: 2 steps: - name: Check out code into uses: actions/checkout@v3 @@ -46,11 +47,11 @@ jobs: chmod 777 e2e cp e2e /usr/local/bin - - name: Set up JDK 8 + - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: 8 + java-version: ${{ matrix.java }} - name: prepare e2e tests run: | @@ -58,9 +59,4 @@ jobs: - name: run e2e tests run: | - cd e2e-test/scripts - sh test-run.sh -# if grep -q "ERROR failed to verify" e2e.log; then -# echo "failed to verify in e2e tests" -# exit 1 -# fi + cd e2e-test/scripts && sh test-run.sh diff --git a/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml b/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml index e03aa635a..5aed33a4e 100644 --- a/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml +++ b/at-sample/springboot-dubbo-seata/e2e-files/commit.yaml @@ -1 +1 @@ -{"res": "commi"} \ No newline at end of file +{"res": "commit"} \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml index 5be252732..679adb7c2 100644 --- a/at-sample/springboot-dubbo-seata/seata-e2e.yaml +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -5,14 +5,13 @@ e2e: max: 5 interval: 10s total_timeout: 20m - # 多服务配置, 有一个test模块用于触发测试,其余皆为provider + # services in docker-compose modules: - # 划分为不同的模块后续可以做功能扩展 + # consume services consumers: # docker service name - - name: springboot-dubbo-seata-business - # 这里可以加一些插件实现不同功能 - # docker service 下的参数,这样写是为了方便后续扩展解耦 + - name: springboot-dubbo-seata-business # this name should be the same as module name, it is indicated to be builded as an image + # service params in a service of docker-compose service docker_service: hostname: springboot-dubbo-seata-business restart: on-failure @@ -27,6 +26,7 @@ e2e: environment: zookeeper.address: zookeeper seata.address: seata + # provider service providers: - name: springboot-dubbo-seata-account docker_service: @@ -67,6 +67,7 @@ e2e: zookeeper.address: zookeeper mysql.address: mysqlAddress seata.address: seata + # infrastructure services infrastructures: - name: mysql docker_service: @@ -109,9 +110,12 @@ e2e: timeout: 10s retries: 3 + # cases to verify cases: - name: rollback test + # how to invoke the case invoke: 'docker exec test curl http://127.0.0.1:9991/testRollback' + # the result of the case to expect be verify: './e2e-files/rollback.yaml' - name: commit test diff --git a/e2e-test/README-CN.md b/e2e-test/README-CN.md new file mode 100644 index 000000000..b488e8e88 --- /dev/null +++ b/e2e-test/README-CN.md @@ -0,0 +1,41 @@ +## Seata E2E Test Quick Start +### 准备测试依赖框架 +E2E测试依赖三方测试框架 [ apache/skywalking-infra-e2e](https://github.com/apache/skywalking-infra-e2e) +如运行环境已安装go,可使用以下命令安装 +```yaml +cd seata-samples +cd e2e-test/scripts +sh prepare_skywalkingE2E.sh +``` +### 构建测试文件 +使用以下命令构建镜像,测试文件,构建完后的测试文件在`seata-samples/tmp`下 +``` +cd seata-samples +cd e2e-test/scripts +sh prepare_skywalkingE2E.sh +``` +### 运行测试案例 +使用以下命令运行案例,该命令会在`seata-samples/tmp`下根据所有测试文件依次进行案例测试 +``` +cd seata-samples +cd e2e-test/scripts +sh test-run.sh +``` +### 添加测试用例 +测试用例配置文件名为:`seata-e2e.yaml`,放在每个需要测试的工程basedir下。 +在basedir下创建`e2e-files`目录,将需在容器中挂载的文件,E2E测试的期待验证结果等测试期间使用的文件放入其中。该文件夹会随着构建测试案例时一起被放在该测试案例的相对目录下,方便使用。 +具体使用案例可见`at-sample/springboot-dubbo-seata` +### 测试框架原理 +seata e2e框架会将samples工程中需要测试的项目进行识别,构建docker镜像,docker-compose文件及测试所依赖的文件。并使用E2E测试框架[ apache/skywalking-infra-e2e](https://github.com/apache/skywalking-infra-e2e)根据所生成测试文件进行测试。目前已部署github action对所有测试用例进行自动测试。 + +- 基于docker-compose 以容器方式运行 +- e2e-test-builder 模块构建seata-samples下镜像,生成测试框架所使用的测试文件 +- e2e-test-runner 模块找到e2e-test-builder构建的测试案例,依次使用E2E测试框架进行案例验证 +#### 测试步骤 +下面是脚本自动完成的步骤,只需要理解,不需要手工执行。 +对每个测试案例来说,都会按照下面的步骤进行处理。 + +- 根据测试项目和`seata-e2e.yaml`自动进行镜像构建,构建过程中会在`tmp/images`下生成相关文件 +- 拷贝测试项目下`e2e-files`目录,根据`seata-e2e.yaml`生成docker-compose文件和e2e.yaml文件用于测试 +- 使用E2E测试框架执行e2e.yaml文件,开启一个案例下的测试 +- 等待测试结果是否成功 diff --git a/e2e-test/README-EN.md b/e2e-test/README-EN.md new file mode 100644 index 000000000..75a0eafe6 --- /dev/null +++ b/e2e-test/README-EN.md @@ -0,0 +1,45 @@ +## Seata E2E Test Quick Start +### Prepare test dependency framework. +E2E testing depends on the third-party testing framework [apache/skywalking-infra-e2e](https://github.com/apache/skywalking-infra-e2e). If Go is already installed in your environment, you can use the following command for installation: +```yaml +cd seata-samples +cd e2e-test/scripts +sh prepare_skywalkingE2E.sh +``` +### Build test files +Use the following command to build the image and test files. After building, the test files will be located in `seata-samples/tmp`. +``` +cd seata-samples +cd e2e-test/scripts +sh prepare_skywalkingE2E.sh +``` +### Run test cases +Use the following command to run the scenes. This command will sequentially execute scene tests based on all test files under `seata-samples/tmp`. +``` +cd seata-samples +cd e2e-test/scripts +sh test-run.sh +``` +### Add test cases +The test case config file is named `seata-e2e.yaml` and should be placed under the basedir of each project that needs testing. +Under the basedir, create an `e2e-files` directory. Place the files that need to be mounted in the container during testing, +as well as the expected verification results and other files used during the test, into this directory. +This folder will be placed under the directory of the test case along with the construction of the test case. +For specific usage examples, refer to `at-sample/springboot-dubbo-seata`. +### Test framework principles +The Seata E2E framework identifies projects in the `samples` directory that require testing, builds Docker images, Docker-compose files, +and files required for testing. It uses the E2E testing framework [apache/skywalking-infra-e2e](https://github.com/apache/skywalking-infra-e2e) +to test according to the generated test files. GitHub Actions are deployed to automatically test all test cases. + +- Runs containers based on Docker-compose file. +- The `e2e-test-builder` module builds images under `seata-samples` and generates test files used by the testing framework. +- The `e2e-test-runner` module identifies test cases built by `e2e-test-builder` and sequentially validates them using the E2E testing framework. + +#### Test steps +Below are the automated steps for test. You only need to understand them; manual execution is not required. +For each test case, the following steps will be performed: +- Automated image construction based on the `seata-e2e.yaml` in test project. Relevant files will be generated under `tmp/images` during construction. +- Copy the `e2e-files` directory from the test project and generate docker-compose files and `e2e.yaml` files for testing based on `seata-e2e.yaml`. +- Execute `e2e.yaml` file using the E2E testing framework to initiate testing for a test. +- Await the success of the test results. + From da9f91cfa79f3d64a1106f4e31564322d4a1bc13 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sun, 21 Apr 2024 00:16:25 +0800 Subject: [PATCH 36/40] feat: fix e2e action --- at-sample/springboot-dubbo-seata/seata-e2e.yaml | 3 +++ .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml index 679adb7c2..b08647f9d 100644 --- a/at-sample/springboot-dubbo-seata/seata-e2e.yaml +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -40,6 +40,7 @@ e2e: environment: zookeeper.address: zookeeper mysql.address: mysqlAddress + mysql.user: user seata.address: seata - name: springboot-dubbo-seata-order docker_service: @@ -53,6 +54,7 @@ e2e: environment: zookeeper.address: zookeeper mysql.address: mysqlAddress + mysql.user: user seata.address: seata - name: springboot-dubbo-seata-storage docker_service: @@ -66,6 +68,7 @@ e2e: environment: zookeeper.address: zookeeper mysql.address: mysqlAddress + mysql.user: user seata.address: seata # infrastructure services infrastructures: diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties index 8593a4839..a6d20505e 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties @@ -1,7 +1,7 @@ spring.application.name=springboot-dubbo-seata-account spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata??useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC -spring.datasource.username=user +spring.datasource.username=${mysql.user:root} spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-account seata.tx-service-group=my_test_tx_group diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties index cf7aa9ad4..d95620477 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties @@ -1,7 +1,7 @@ spring.application.name=springboot-dubbo-seata-order spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC -spring.datasource.username=user +spring.datasource.username=${mysql.user:root} spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-order seata.tx-service-group=my_test_tx_group diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties index 48ce97f5f..14696968d 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties @@ -1,7 +1,7 @@ spring.application.name=springboot-dubbo-seata-storage spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC -spring.datasource.username=user +spring.datasource.username=${mysql.user:root} spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-storage seata.tx-service-group=my_test_tx_group From f7bb7fa9daebbf0b08870c048fcb0715feaa62b0 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sun, 21 Apr 2024 00:25:50 +0800 Subject: [PATCH 37/40] feat: fix e2e action --- e2e-test/e2e-test-builder/.gitignore | 38 ---------------------------- e2e-test/e2e-test-runner/.gitignore | 38 ---------------------------- 2 files changed, 76 deletions(-) delete mode 100644 e2e-test/e2e-test-builder/.gitignore delete mode 100644 e2e-test/e2e-test-runner/.gitignore diff --git a/e2e-test/e2e-test-builder/.gitignore b/e2e-test/e2e-test-builder/.gitignore deleted file mode 100644 index 5ff6309b7..000000000 --- a/e2e-test/e2e-test-builder/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ -*.iws -*.iml -*.ipr - -### Eclipse ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ - -### Mac OS ### -.DS_Store \ No newline at end of file diff --git a/e2e-test/e2e-test-runner/.gitignore b/e2e-test/e2e-test-runner/.gitignore deleted file mode 100644 index 5ff6309b7..000000000 --- a/e2e-test/e2e-test-runner/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ -*.iws -*.iml -*.ipr - -### Eclipse ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ - -### Mac OS ### -.DS_Store \ No newline at end of file From a4f304b768b85af12c49911d1d5167981f3568eb Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 27 Apr 2024 21:09:40 +0800 Subject: [PATCH 38/40] feat: add license --- .../org/apache/seata/e2e/E2EController.java | 16 +++++++++++++++ .../java/org/apache/seata/BuilderMain.java | 16 +++++++++++++++ .../org/apache/seata/builder/E2EBuilder.java | 18 +++++++++++++++-- .../apache/seata/builder/ImageBuilder.java | 16 +++++++++++++++ .../apache/seata/builder/SceneBuilder.java | 16 +++++++++++++++ .../apache/seata/config/ConfigConstants.java | 16 +++++++++++++++ .../org/apache/seata/config/ConfigReader.java | 17 +++++++++++++++- .../generator/DockerComposeGenerator.java | 20 +++++++++++++++---- .../generator/DockerFileForJarGenerator.java | 16 +++++++++++++++ .../generator/SkyWalkingE2EFileGenerator.java | 18 +++++++++++++++-- .../java/org/apache/seata/model/Case.java | 16 +++++++++++++++ .../java/org/apache/seata/model/DependOn.java | 16 +++++++++++++++ .../org/apache/seata/model/DockerService.java | 16 +++++++++++++++ .../org/apache/seata/model/E2EConfig.java | 16 +++++++++++++++ .../org/apache/seata/model/E2EWrapper.java | 16 +++++++++++++++ .../java/org/apache/seata/model/Inherit.java | 16 +++++++++++++++ .../java/org/apache/seata/model/Module.java | 16 +++++++++++++++ .../java/org/apache/seata/model/Modules.java | 16 +++++++++++++++ .../java/org/apache/seata/model/Retry.java | 16 +++++++++++++++ .../java/org/apache/seata/util/Utils.java | 16 +++++++++++++++ .../src/main/resources/template/at-common | 0 .../java/org/apache/seata/RunnerMain.java | 16 +++++++++++++++ .../controller/SkyWalkingController.java | 16 +++++++++++++++ 23 files changed, 352 insertions(+), 9 deletions(-) delete mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/at-common diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java index 405f754a8..efbad318d 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.e2e; import org.apache.seata.service.BusinessService; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java index 9599d3489..24e27fa36 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata; import org.apache.seata.builder.E2EBuilder; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java index 7e02ee654..27ebb0e7d 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java @@ -1,10 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.builder; import org.apache.seata.config.ConfigConstants; import org.apache.seata.config.ConfigReader; import org.apache.seata.model.E2EConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java index 7f14179f4..4d2ec344a 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.builder; import org.apache.seata.generator.DockerFileForJarGenerator; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java index ea46bd319..164350c44 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.builder; import org.apache.commons.io.file.PathUtils; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java index 069c7ca7c..c57785a4f 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.config; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java index dceddaa48..639ee0cd6 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.config; import org.apache.seata.model.E2EConfig; @@ -7,7 +23,6 @@ import java.io.*; import java.nio.file.Files; -import java.nio.file.Paths; /** * @author jingliu_xiong@foxmail.com diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java index 4a1def83f..109695d8b 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java @@ -1,11 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.generator; import freemarker.template.Configuration; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; -import org.apache.seata.config.ConfigConstants; import org.apache.seata.model.E2EConfig; -import org.apache.seata.model.Module; import org.apache.seata.model.Modules; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,9 +27,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.nio.file.Paths; import java.util.HashMap; -import java.util.List; import java.util.Map; import static org.apache.seata.config.ConfigConstants.COMPOSE_FILE; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java index 5645ddcd6..b324f4cf8 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.generator; import freemarker.template.Configuration; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java index 14724a086..c93eb81c3 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.generator; import freemarker.template.Configuration; @@ -14,8 +30,6 @@ import java.util.HashMap; import java.util.Map; -import static org.apache.seata.config.ConfigConstants.COMPOSE_FILE; - /** * @author jingliu_xiong@foxmail.com */ diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java index d9280da6b..c977dba35 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java index 8b1ef8dc9..ada2c1409 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java index 44e3609ca..240aa24f3 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; import java.util.List; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java index d4e4a0b17..6a8dab183 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java index c3dd36018..26004e687 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java index 7188140af..69d2e73db 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; import java.util.Map; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java index af8ed5e14..cb07e86b2 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java index ee2ca370f..8a65f3bcc 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; import java.util.List; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java index cb7383f8f..b74206445 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.model; /** diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java index 770a35126..9dd78c1e7 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.util; import org.slf4j.Logger; diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/at-common b/e2e-test/e2e-test-builder/src/main/resources/template/at-common deleted file mode 100644 index e69de29bb..000000000 diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java index 6a9aea075..ad2e0bc86 100644 --- a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata; import org.apache.seata.config.ConfigConstants; 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 9dce248d3..c9930f6d8 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 @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.seata.controller; import org.apache.seata.util.Utils; From 6139be8bb3843f3c5f4d71bdac61d47510299abc Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 11 May 2024 09:35:29 +0800 Subject: [PATCH 39/40] feat: add license --- .github/workflows/E2E.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 6f362bbe0..56fae40db 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "E2E Test" +name: "Seata E2E Test" on: [ push,pull_request ] From 7ebeff53b0d267a8397f5f8cde941ca813a50c66 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Sat, 11 May 2024 12:34:22 +0800 Subject: [PATCH 40/40] fix: fix e2e framework to right version --- .github/workflows/E2E.yml | 4 ++-- e2e-test/scripts/prepare_skywalkingE2E.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 56fae40db..e662eae94 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -36,9 +36,9 @@ jobs: go-version: 1.18 id: go - - name: Build e2e framework + - name: Build e2e framework (use skywalking-infra-e2e v1.3.0) run: | - cd skywalking-infra-e2e && make linux + cd skywalking-infra-e2e && git checkout 1485ae03f0ad90496ad7626a5ae4a6a73a1f6296 && make linux - name: Add script directory to PATH run: | diff --git a/e2e-test/scripts/prepare_skywalkingE2E.sh b/e2e-test/scripts/prepare_skywalkingE2E.sh index 43a8d282a..34283f120 100644 --- a/e2e-test/scripts/prepare_skywalkingE2E.sh +++ b/e2e-test/scripts/prepare_skywalkingE2E.sh @@ -1 +1,2 @@ -go install github.com/apache/skywalking-infra-e2e/cmd/e2e@latest \ No newline at end of file +# use skywalking-infra-e2e v1.3.0 +go install github.com/apache/skywalking-infra-e2e/cmd/e2e@1485ae03f0ad90496ad7626a5ae4a6a73a1f6296 \ No newline at end of file