github动作上的自动邮递员测试因ECONNREFUSED失败

时间:2020-05-25 09:19:18

标签: postman github-actions

我正在尝试根据Pull请求设置工作流程。
这些工作是:

  • 设置MySQL数据库
  • 构建和测试NetCore API
  • 运行自动邮递员测试

yml文件如下所示:

name: .NET Core, MySQL and Postman

on:
  pull_request:
    branches: [ master, dev ]

jobs:
  test_and_build_API:
    runs-on: ubuntu-latest

    steps:
    - name: Setup MySQL
    - uses: mirromutth/mysql-action@v1.1
      with:
        collation server: 'utf8_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
        mysql version: '8.0' # Optional, default value is "latest". The version of the MySQL
        mysql database: 'FantasyFestivals' # Optional, default value is "test". The specified database which will be create
        mysql root password: 'root' # Required if "mysql user" is empty, default is empty. The root superuser password:

    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 3.1.101
    - name: Install dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --configuration Release --no-restore
    - name: Test_Postman
      uses: matt-ball/newman-action@master
      with:
        collection: Postman/MedievalFestivals - Medieval Festivals RestAPI.postman_collection.json
        environment: Postman/FantasyFestivals Tesing.postman_environment.json
    - name: Test
      run: dotnet test --no-restore --verbosity normal

错误 使用newman运行自动邮递员测试时,工作流在第3步失败。

MedievalFestivals - Medieval Festivals RestAPI

❏ api/festivals
↳ Get Festivals
  1⠄ TypeError in prerequest-script
  GET https://localhost:5001/api/festivals?PageSize=45 [errored]
     connect ECONNREFUSED 127.0.0.1:5001
  3⠄ JSONError in test-script
_tls_wrap.js:549
  self._destroySSL();

问题:

  • (已在评论中对此进行了回答)每个作业中的内置容器在作业完成后是否消失(得到清理)?因此,当作业“ test_and_build”启动时,该作业将无法再访问MySQL数据库?如果是这样,我是否必须将每个作业的步骤放在一个作业中?
  • 如何解决ECONNREFUSED错误?

感谢您的帮助。
虚拟马铃薯:?

0 个答案:

没有答案