-
Notifications
You must be signed in to change notification settings - Fork 186
Test execution data of utPLSQL project not showing on SonarCloud #1198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think the CLI should resolve all filepath under
as per https://github.com/utPLSQL/utPLSQL-cli Ideally if we can avoid running twice would be ideal, or changing default behaviour. |
We need to rename the folder: |
I take this back. |
The parameters that seem to work for me locally were:
I have tested it locally with UT_DEBUG_REPORTER to see what are the file mappings generated by utPLSQL file mapper.
|
@felipebz I've managed to fix the issue by change to how file mapping is interpreted (owner extracted from file path). |
Recently I saw this comment saying that the unit test data isn't showing on your SonarCloud project, then I decided to investigate this issue further and I would like to discuss what's the best way to fix it.
Just for reference, this is how the SonarCloud panel looks like now:
And how it should look like:
I saw that the
utplsql-cli
is executed using the userut3_test_helper
, but the unit tests are being compiled on usersut3_tester
andut3$user#
and the option-owner
for the test files is being omitted (line 10):utPLSQL/test/run_tests.sh
Lines 7 to 11 in b4d72e3
When this option is omitted and there's no other mapping rule to identify the owner of a file by its path, the
ut_file_mapper
package assumes that the owner is the user running the tests, which is the userut3_test_helper
:utPLSQL/source/core/ut_file_mapper.pkb
Lines 102 to 105 in b4d72e3
But actually the
ut3_test_helper
doesn't own any unit test and, as result, thetest_results.xml
file generated byut_sonar_test_reporter
doesn't contain any file path. This is the reason that the unit test data isn't being uploaded to SonarCloud.The log of the "SonarCloud Scan" step on the GitHub Actions (example) also shows this, because the files aren't mapped correctly:
One way I found to fix this issue without any changes to the utPLSQL code is executing the
utplsql-cli
twice, one for each schema, like:But this would required some other changes to the build pipeline because the generated reports would also be duplicated.
Another alternative, that makes more sense to me, is to not assume any default value for the file owner on
ut_file_mapper
and change theut_file_mapping
usages (example) to compare the owner only if it's present. With this change, if there's no owner defined on the object-to-file mapping rules, the code will compare only the object name and object type to find the corresponding file, which should be good enough for most situations.What do you folks think about it?
The text was updated successfully, but these errors were encountered: