使用gitHub Action中失败的测试范围测试

问题描述 投票:0回答:1
,但是,在github操作中,我会收到每个测试的错误:

[xUnit.net 00:00:55.13]     IntegrationTests.MessageExchangeTests.TestLikeServiceSendsMessage [FAIL]
[xUnit.net 00:00:55.13]       Docker.DotNet.DockerApiException : Docker API responded with status code=Conflict, response={"message":"Container 46496d12b6c11c2c43edb96301bbfa1c9ddde217c0c54bb22e3a72ef8e479fb5 is not running"}

Extra信息:

[testcontainers.org 00:00:00.07] Connected to Docker: Host: unix:///var/run/docker.sock Server Version: 24.0.9 Kernel Version: 6.5.0-1018-azure API Version: 1.43 Operating System: Ubuntu 22.04.4 LTS Total Memory: 15.61 GB
GITHUB工作流程:

name: .NET on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x test: name: Test runs-on: ubuntu-latest needs: build integration-test: name: Integration Test runs-on: ubuntu-latest needs: build steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - name: Check Docker version run: docker --version - name: Start Docker run: sudo service docker start - name: Restore dependencies for Integration Tests run: dotnet restore ./IntegrationTests - name: Build Integration Tests run: dotnet build ./IntegrationTests --no-restore - name: Run Integration Tests run: dotnet test ./IntegrationTests --no-build --verbosity normal
如何解决?

我们通过在我们的管道中设置这些常数来修复它:在您的测试步骤上方:

.net docker github-actions xunit testcontainers
1个回答
0
投票

env: REGISTRY: ghcr.io TESTCONTAINERS_HOST_OVERRIDE: "host.docker.internal" TESTCONTAINERS_RYUK_DISABLED: "true"

    
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.