-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Spring Cloud Alibaba Auto-Test Design | Spring Cloud Alibaba自动化测试方案设计 #2705
Comments
如果有任何建议或者希望社区实现的自动化测试方案可以在这里讨论 |
Englist Version: BackgroundAt present, we need to design a set of integration testing solutions for the project. In order to solve the problem of user issue reproduction caused by version release, we will test based on Program DesignIn the community's attempt at the beginning of the year, marking the However, in this way, in the integration test the configuration initialization of the test and the preloading of the bean cannot be prepared. And for the test of
Design Ideas and Compromises
Scheme comparison
|
This issue has been open 30 days with no activity. This will be closed in 7 days. |
This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community. |
背景
相关议题: #2566
目前我们需要为项目设计一套集成测试方案,为解决版本发布造成用户的issue复现困难,基于
testcontainer
+Github Action
进行测试,以便于覆盖spring-cloud-alibaba
每次接入新组件特性时候的用例,提升项目稳定性设计方案
在社区年初的尝试当中,通过先在需要进行集成测试的类上标记
@HasDockerAndItEnabled
注解的方式 , 在Github Action当中 执行mvn clean -Dit.enabled=true test
, 运行所有集成测试但是这种方式在集成测试当中,无法对测试的配置初始化, bean的预加载进行准备。并且针对
nacos
和rocketmq
的测试,需要保证在测试运行之前,保持相关testcontainer的测试镜像稳定运行并测试, 所以目前对于Github Action的落地有两种方案可供讨论:方案一 junit5 callback + docker-compose
目前的PR 是基于
org.junit.jupiter.api
的回调函数 在用户运行测试之前,从上下文里面获取docker-compose
文件的信息。然后在callback函数内完成容器运行. 之后执行测试方案二
maven Profile
+dockerfile-maven-plugin
构建出Docker镜像和完成推送 +docker Load
加载打包spring-cloud-alibaba-tests
的构建产物spring-cloud-alibaba-tests.tar
包:通过参考shardingsphere的CI方式, 构建SCA的CI环境
shardingsphere构建步骤
目前实现的方式分为两步骤:
dockerhub
, 将nacos
,rocketmq
,sentinel
,seata
等镜像 放在同一个dockerhub
账号下,执行集成测试时,拉取相关镜像(默认是在alibaba的容器镜像服务当中,所以在docker.yml中会在alibaba仓库中搜索)docker load
执行归档文件目前方案一目前处于poc阶段,方案二处于测试阶段
设计思路以及折中
方案一: 添加
@SpringCloudAlibaba
以及@TestExtend
两个注解,在测试用例当中分为构建一个@BeforeEach
标记的静态方法以及@BeforeAll
标记的非静态方法, 如果测试线程的执行时间较长,可以修改@TestExtend
里面的timeout
属性方案二: 当Github Action执行完
spring-cloud-alibaba-tests.tar
测试jar打包,镜像构建推送等流程之后,基于脚本对于-Denv=docker
的环境做测试(可以在PR中定位到run: ./build/run_integration_group.sh CLI
这一行) , 运行打包的集成测试方法方案对比
对于方案一而言: 由于没有将测试统一打包执行,所以每运行一个测试就要从github拉一次镜像
对于方案二而言: 镜像的构建和推送统一交给Github Action做管理。测试统一打包后执行 不需要每次进行镜像构建和推送
对于方案一而言: 会随着测试的增加,延长每次用户提交PR时触发ci的时间,属于短线规划
对于方案二而言: 统一管理镜像的构建和推送 收敛测试范围,每次用户提交PR时触发ci时间可控, 可通过脚本拓展分组测试
The text was updated successfully, but these errors were encountered: