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

[WIP] feat: add e2e framework support #651

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 63 additions & 0 deletions .github/workflows/E2E.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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: "E2E Test"

on:
push:
branches: [ e2e-demo ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ e2e-demo ]
#
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ target/
/distribution/lib
server/*root.*
server/.root.*
tmp/

# system ignore
.DS_Store
Expand Down
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/expected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"res": "success"}
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`);
115 changes: 115 additions & 0 deletions at-sample/springboot-dubbo-seata/seata-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
e2e:
scene_name: at-springboot-dubbo-seata
# 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:
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
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
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
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
seata.address: seata
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:
- name: normal test
invoke: 'docker exec test curl http://127.0.0.1:9991/testCreate'
verify: './e2e-files/expected.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.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?userSSL=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
Loading
Loading