Question, Bug, or Feature?
Type: Question
Enter Task Name: PublishTestResults@2
Account details are sensitive, I don't want to disclose them publicly.
PublishTestResults@2 appears to only search the paths on the agent and not on the docker container, despite the container being defined as part of the job
Take the following example:
trigger:
- master
resources:
containers:
- container: linux
image: customer-container:tag
jobs:
- job: build_linux
pool:
vmImage: 'ubuntu-16.04'
container: linux
variables:
- group: Secrets
- name: SHELL
value: bash
- name: CI
value: azure
steps:
- checkout: self
fetchDepth: 1
- script: |
go test -v some-package | go2xunit -output /tmp/tests.xml
displayName: Unit Tests
- task: PublishTestResults@2
inputs:
testResultsFormat: XUnit
testResultsFiles: /tmp/tests.xml
failTaskOnFailedTests: true
This will fail because /tmp/tests.xml is not found. I assume because it is looking for it on the host agent and not on the container. I have searched through the docs and cannot find any direction on how to do this properly. Any suggestions would be more than welcome, thank you!
@smalpani-msft can you have someone take a look at this?
I'm sorry, I should've come back to this. I've since resolved the issue. The issue being something with the test reporting itself.
There was also definitely an issue with Azure finding files and giving misleading errors, but I don't have specific reproduction steps or a concise description of that problem. Probably best to close this, or you can use the repro steps I've given to see for yourself how the errors were misleading, up to you guys..
Just in case anybody else is looking for a solution. I have to explicitly add "searchFolder" when running in a container. The searchFolder default is fine when not running in container.
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/junit.xml'
testRunTitle: 'Unittest results'
searchFolder: '$(Build.BinariesDirectory)'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'cTest'
testResultsFiles: '**/Test.xml'
testRunTitle: 'Test results for CTest'
searchFolder: '$(Build.BinariesDirectory)'
Nice, thanks for sharing @rene-fonseca!
Most helpful comment
Just in case anybody else is looking for a solution. I have to explicitly add "searchFolder" when running in a container. The searchFolder default is fine when not running in container.