Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

【Contributor 文档】弹性运维调度系统 module-controller 单元测试和集成测试流程 #2

Closed
lylingzhen opened this issue Jul 27, 2023 · 2 comments
Assignees

Comments

@lylingzhen
Copy link
Contributor

lylingzhen commented Jul 27, 2023

注:当前流水线只支持 module-controller master 分支,若需要跑其它分支可在社区协作钉钉群(群号:24970018417)讨论并提交 PR。

单元测试

自动执行

任意 Contributor 修改 module-controller 代码并发起 PR 到 master 分支或者在 master 分支 PR 合并之后,单元测试的 Workflow 会被自动执行,您可在 PR 的流水线中看到单元测试的执行结果,单测 Workflow 执行通过才允许合并。比如:https://github.com/sofastack/sofa-serverless/pull/50/checks

image

您也可前往 GitHub Workflow 直接查看执行结果:https://github.com/sofastack/sofa-serverless/actions/workflows/module_controller_unit_test.yml


手动执行

  1. 进入 GitHub Workflow:https://github.com/sofastack/sofa-serverless/actions/workflows/module_controller_unit_test.yml

  2. 点击右上角 "Run workflow" -> "Run workflow":

image

  1. 等待 Workflow 执行完成,可以点击查看执行详情:

image

image

如何修改 Workflow

Workflow 定义文件:https://github.com/sofastack/sofa-serverless/blob/master/.github/workflows/module_controller_unit_test.yml ,可按需修改并提交 PR。
注:当前尚未开启 go build 增量构建,欢迎大家指教如何配置开启。


集成测试

流水线位置

https://github.com/sofastack/sofa-serverless/blob/master/.github/workflows/module_controller_build_deploy_to_aliyun.yml

流水线触发时机

module-contorller/ 目录里的代码 PR 完成到 master 分支的合并之后,会触发该流水线执行。每次正式 Release 版本前,必须保证集成测试流水线成功执行。

集成测试原理

有输入和建议欢迎补充。

集成测试用例写在 module-controller/integration-tests 里。module-controller/IntegrationTestDockerfile 是用来构建集成测试应用的 Dockerfile,构建出的集成测试应用是一次性 Job,集成测试用例跑完后销毁。

每一个集成测试用例都会发起一条运维链路(比如正常的模块发布链路;带 Beta 和分组确认的模块发布链路等等),并对中间件结果进行详细 Assert 验证和日志输出,在所有集成测试跑完后,集成测试应用结束。

module-controller/IntegrationTestDockerfile 是集成测试构建运行的 Dockerfile。

流水线步骤

  1. 登录阿里云镜像服务。
  2. 使用 module-controller/Dockerfile 打包构建出 module-controller Operator 镜像。
  3. 使用 module-controller/IntegrationTestDockerfile 打包构建出集成测试应用镜像,该镜像包含了所有集成测试用例。
  4. 将镜像上传到阿里云镜像服务。
  5. 调用阿里云容器服务重新部署 Operator 镜像和集成测试镜像。
  6. 临时:Github 构建机与阿里云 APIServer 网络不可达,当前测试镜像部署后需要到阿里云登录 module-controller-integration-tests pod 查看执行结果。
  7. workflow 执行通过才允许正式发版。
@lylingzhen lylingzhen changed the title 建设 SOFAServerless CI 建设 SOFAServerless CI 能力 Jul 27, 2023
@lylingzhen lylingzhen changed the title 建设 SOFAServerless CI 能力 建设 SOFAServerless CI 环境 Jul 27, 2023
@lylingzhen lylingzhen changed the title 建设 SOFAServerless CI 环境 建设 SOFAServerless 从运维调度到客户端端到端 CI 环境 Jul 27, 2023
@lylingzhen lylingzhen self-assigned this Jul 27, 2023
@lylingzhen lylingzhen changed the title 建设 SOFAServerless 从运维调度到客户端端到端 CI 环境 运维调度系统 CI 环境与流程 Aug 15, 2023
@lylingzhen lylingzhen changed the title 运维调度系统 CI 环境与流程 弹性运维调度系统 CI 环境与流程 Aug 15, 2023
@lylingzhen lylingzhen changed the title 弹性运维调度系统 CI 环境与流程 弹性运维调度系统 CI 流程 Aug 15, 2023
@lylingzhen
Copy link
Contributor Author

#26 中跟进。

@lylingzhen lylingzhen changed the title 弹性运维调度系统 CI 流程 弹性运维调度 module-controller 系统 CI 流程 Aug 28, 2023
@lylingzhen lylingzhen changed the title 弹性运维调度 module-controller 系统 CI 流程 【Contributor 文档】弹性运维调度 module-controller 系统单元测试和集成测试 CI 流程 Aug 28, 2023
@lylingzhen lylingzhen changed the title 【Contributor 文档】弹性运维调度 module-controller 系统单元测试和集成测试 CI 流程 【Contributor 文档】弹性运维调度 module-controller 系统单元测试和集成测试流程 Aug 28, 2023
@lylingzhen lylingzhen changed the title 【Contributor 文档】弹性运维调度 module-controller 系统单元测试和集成测试流程 【Contributor 文档】弹性运维调度系统 module-controller 单元测试和集成测试 Aug 28, 2023
@lylingzhen lylingzhen changed the title 【Contributor 文档】弹性运维调度系统 module-controller 单元测试和集成测试 【Contributor 文档】弹性运维调度系统 module-controller 单元测试和集成测试流程 Aug 28, 2023
@lylingzhen
Copy link
Contributor Author

lylingzhen commented Aug 28, 2023

@gold300jin 关注。

yuanyuancin pushed a commit that referenced this issue Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant