Issue
GitLab runner hangs, and eventually times out after 60 minutes, when running dotnet test
. No errors, no logs for test execution.
These are the last traces I can see
$ dotnet test --blame --configuration Release
Determining projects to restore...
Restored //omitted restored traces
MyProgram.FunctionalTests -> /builds/mygroup/myprogram/test/MyProgram.FunctionalTests/bin/Release/net5.0/MyProgram.FunctionalTests.dll
Test run for /builds/mygroup/myprogram/test/MyProgram.FunctionalTests/bin/Release/net5.0/MyProgram.FunctionalTests.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.9.1
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
and here it hangs indefinitely.
It looks very similar to what some people are experiencing in GitHub, so maybe the problem is related to the dotnet SDK 5.0 image, but not sure.
How to reproduce
I cannot reproduce it locally. Running dotnet test
locally completes properly
Sample CI/CD yml
variables:
ENTRYPOINT_DLL: MyProgram.dll
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- build
- test
- release
- image
build:
stage: build
script:
- dotnet restore --no-cache --force
- dotnet build --configuration Release --no-restore
artifacts:
paths:
- test
expire_in: 1 hour
unit_tests:
stage: test
services:
- name: localstack/localstack:0.11.2
alias: localstack
variables:
AWS_DEFAULT_REGION: "us-east-1"
EDGE_PORT: "4566"
SERVICES: "sns,sqs"
before_script:
- rounds=10;
while [ $rounds -gt 0 ]; do
curl http://localstack:4566 && echo OK && break || echo FAIL
rounds=$rounds - 1;
sleep 5;
done;
script: dotnet test --blame --configuration Release
rules:
- exists:
- test/**/*Tests.csproj
publish:
stage: release
script:
- dotnet publish -c Release -o publish
artifacts:
paths:
- publish/
expire_in: 1 hour
gitlab_registry:
stage: image
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "FROM mcr.microsoft.com/dotnet/aspnet:5.0" > $CI_PROJECT_DIR/Dockerfile
- echo "COPY publish/ ." >> $CI_PROJECT_DIR/Dockerfile
- echo "EXPOSE 80" >> $CI_PROJECT_DIR/Dockerfile
- echo "ENTRYPOINT [\"dotnet\", \"$ENTRYPOINT_DLL\"]" >> $CI_PROJECT_DIR/Dockerfile
- cat $CI_PROJECT_DIR/Dockerfile
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- cat /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest --destination $CI_REGISTRY_IMAGE:$CI_JOB_ID
Anybody experiencing the same? Any idea on how to find out what’s going on behind the scenes or why is stuck?
Thanks