Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add e2e framework support #654

Merged
merged 42 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1b3052f
feat: add e2e framework support
xjlgod Apr 1, 2024
a8e9e00
fix: del compose file
xjlgod Apr 1, 2024
b1eb6f8
feat: add e2e framework sh
xjlgod Apr 8, 2024
aa59811
feat: add e2e demo in network
xjlgod Apr 15, 2024
ba0b3f3
feat: fix e2e action
xjlgod Apr 15, 2024
74f92ee
feat: fix e2e action
xjlgod Apr 16, 2024
fedf766
feat: fix e2e action
xjlgod Apr 16, 2024
ca1acfc
feat: fix e2e action
xjlgod Apr 16, 2024
a26085d
feat: fix e2e action
xjlgod Apr 16, 2024
7b548bc
feat: fix e2e action
xjlgod Apr 16, 2024
d718d0e
feat: fix e2e action
xjlgod Apr 16, 2024
b73a355
feat: fix e2e action
xjlgod Apr 16, 2024
588ce40
feat: fix e2e action
xjlgod Apr 16, 2024
1bd4f8d
feat: fix e2e action
xjlgod Apr 16, 2024
48f1261
feat: fix e2e action
xjlgod Apr 16, 2024
04d5d23
feat: fix e2e action
xjlgod Apr 16, 2024
e39cb30
feat: fix e2e action
xjlgod Apr 16, 2024
aa9239d
feat: fix e2e action
xjlgod Apr 16, 2024
13da4b2
feat: fix e2e action
xjlgod Apr 16, 2024
f08711b
feat: fix e2e action
xjlgod Apr 16, 2024
9b02727
feat: fix e2e action
xjlgod Apr 16, 2024
f4f578d
feat: fix e2e action
xjlgod Apr 16, 2024
2c2a0b4
feat: fix e2e action
xjlgod Apr 16, 2024
82beaa2
feat: fix e2e action
xjlgod Apr 16, 2024
7405233
feat: fix e2e action
xjlgod Apr 16, 2024
f2aba59
feat: fix e2e action
xjlgod Apr 16, 2024
4d8784f
feat: fix e2e action
xjlgod Apr 16, 2024
38380d2
feat: fix e2e action
xjlgod Apr 16, 2024
873def4
feat: fix e2e action
xjlgod Apr 17, 2024
0c2dc46
feat: fix e2e action
xjlgod Apr 20, 2024
26ef086
feat: fix e2e action
xjlgod Apr 20, 2024
6df75b7
feat: fix e2e action
xjlgod Apr 20, 2024
1120d72
feat: fix e2e action
xjlgod Apr 20, 2024
5e8777c
feat: fix e2e action
xjlgod Apr 20, 2024
9b79c6d
feat: fix e2e action
xjlgod Apr 20, 2024
da9f91c
feat: fix e2e action
xjlgod Apr 20, 2024
f7bb7fa
feat: fix e2e action
xjlgod Apr 20, 2024
a4f304b
feat: add license
xjlgod Apr 27, 2024
64ea2d4
Merge branch 'master' into e2e-demo
xjlgod Apr 29, 2024
6139be8
feat: add license
xjlgod May 11, 2024
202149c
Merge branch 'e2e-demo' of github.com:xjlgod/seata-samples into e2e-demo
xjlgod May 11, 2024
7ebeff5
fix: fix e2e framework to right version
xjlgod May 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/E2E.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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: "Seata E2E Test"

on: [ push,pull_request ]

jobs:
run_e2e:
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

- name: Clone skywalking e2e repository
run: git clone https://github.com/apache/skywalking-infra-e2e.git skywalking-infra-e2e

- name: Set up Go 1.18
uses: actions/setup-go@v4
with:
go-version: 1.18
id: go

- name: Build e2e framework (use skywalking-infra-e2e v1.3.0)
run: |
cd skywalking-infra-e2e && git checkout 1485ae03f0ad90496ad7626a5ae4a6a73a1f6296 && make linux

- name: Add script directory to PATH
run: |
cd skywalking-infra-e2e/bin/linux
echo "export PATH=$PATH:$(pwd)" >> $GITHUB_PATH
chmod 777 e2e
cp e2e /usr/local/bin

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}

- name: prepare e2e tests
run: |
cd e2e-test/scripts && sh prepare-test.sh

- name: run e2e tests
run: |
cd e2e-test/scripts && sh test-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
1 change: 1 addition & 0 deletions at-sample/springboot-dubbo-seata/e2e-files/commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"res": "commit"}
1 change: 1 addition & 0 deletions at-sample/springboot-dubbo-seata/e2e-files/rollback.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"res": "rollback"}
56 changes: 56 additions & 0 deletions at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql
Original file line number Diff line number Diff line change
@@ -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`);
126 changes: 126 additions & 0 deletions at-sample/springboot-dubbo-seata/seata-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
e2e:
scene_name: at-springboot-dubbo-seata
# retry config
retry:
max: 5
interval: 10s
total_timeout: 20m
# services in docker-compose
modules:
# consume services
consumers:
# docker service name
- 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
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
environment:
zookeeper.address: zookeeper
seata.address: seata
# provider service
providers:
- name: springboot-dubbo-seata-account
docker_service:
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
mysql.user: user
seata.address: seata
- name: springboot-dubbo-seata-order
docker_service:
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
mysql.user: user
seata.address: seata
- name: springboot-dubbo-seata-storage
docker_service:
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
mysql.user: user
seata.address: seata
# infrastructure services
infrastructures:
- name: mysql
docker_service:
hostname: mysqlAddress
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:
hostname: seata
image: seataio/seata-server:2.0.0
# 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"
healthcheck:
test: '[ "CMD", "echo", "ruok", "|", "nc", "localhost", "2181", "|", "grep", "imok" ]'
interval: 30s
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
invoke: 'docker exec test curl http://127.0.0.1:9991/testCommit'
verify: './e2e-files/commit.yaml'
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
spring.application.name=springboot-dubbo-seata-account
spring.datasource.driverClassName=com.mysql.cj.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.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
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
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
Loading
Loading