Ensure go test coverprofile outputs to the expected location #1105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1104
This PR updates the
runGoTest
function to set the coverprofile to theAbsPathForGeneratedAsset
when the coverprofile isn't already absolute (that seems sensible but I note that isn't the case for therunSerial
function just below which has the same sort of fix?)This should resolve the issue described, where the coverprofile ends up in the test suite dir.
When
outputDir
is not set, theAbsPathForGeneratedAsset
sets the output to the suite's abs path plus the asset name, which is the behaviour right now.When
outputDir
is set, it sets the path to the suite name plus asset name within the output dir. This uses the same logic as is used within the finalize section so should mean things like the keep separate reports and output vs output should behave correctly.Testing locally, if I have no
outputDir
, each suite gets their own coverprofile (both Go and ginkgo suites), if I have anoutputDir
, the error is gone and I get a single profile out which I believe is expected, combining that with
-keep-separate-coverprofiles` gives me a folder of individual coverprofiles based on the suite names.