美文网首页
Harbor开源项目CI与测试框架调研

Harbor开源项目CI与测试框架调研

作者: heliping_peter | 来源:发表于2021-09-28 10:35 被阅读0次

harbor贡献者文档
https://github.com/goharbor/harbor/blob/master/CONTRIBUTING.md
1.提交代码前,开发自测
包含golang单元测试,UI使用karma进行前端的单元测试
开发文档有流程描述

Unit test cases should be added to cover the new code. Unit test framework for backend services is using [go testing](https://golang.org/doc/code.html#Testing). The UI library test framework is built based on [Jasmine](http://jasmine.github.io/2.4/introduction.html) and [Karma](https://karma-runner.github.io/1.0/index.html), please refer to [Angular Testing](https://angular.io/guide/testing) for more details.

2.自测完成后,开始提交代码
查看pr的记录,可以看到流程
commit后,会触发codecov覆盖率测试


image.png

覆盖率测试没有问题后,开始review,review完成后,merge触发CI流程

image.png

3.CI流程使用github action
可以看看CI触发了哪些测试,在.github目录看到编译文件

jobs:
  UTTEST:
    env:
       UTTEST: true
........
 APITEST_DB:
    env:
      APITEST_DB: true
    runs-on:
      #- self-hosted
      - ubuntu-latest
........
 UI_UT:
    env:
      UI_UT: true
    runs-on:
      #- self-hosted
      - ubuntu-latest

4.测试类型
单元测试,使用coverage4gotest

API测试,拉取E2E_IMAGE ,应该是个robot的容器,执行rf框架的测试

docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot --exclude proxy_cache -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2  -v ip1: -v http_get_ca:false -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot

ui测试使用karma

npm install -g -q --no-progress karma

相关文章

网友评论

      本文标题:Harbor开源项目CI与测试框架调研

      本文链接:https://www.haomeiwen.com/subject/rrblnltx.html