-
Notifications
You must be signed in to change notification settings - Fork 191
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
printresults:chore - add tests to cover output and Sonarqube output type #760
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matheusalcantarazup
requested review from
iancardosozup,
lucasbrunozup,
nathanmartinszup and
wiliansilvazup
as code owners
November 9, 2021 17:46
matheusalcantarazup
changed the title
printresults:chore: add tests to cover errors and Sonarqube output
printresults:chore: add tests to cover output and Sonarqube output type
Nov 9, 2021
matheusalcantarazup
force-pushed
the
tests-printressults
branch
4 times, most recently
from
November 9, 2021 17:59
9b86bd2
to
87dce39
Compare
matheusalcantarazup
force-pushed
the
tests-printressults
branch
from
November 10, 2021 11:41
87dce39
to
de4e3c9
Compare
iancardosozup
approved these changes
Nov 10, 2021
This commit add new tests to cover Sonarqube output type and add asserts to check if what was printed is correctly. The tests was changed to use table testings approach to make more easily to add a new testcase. The PrintResults implementation was improved too. Basically a new io.Writer field was added to customize where we will write outputs. The default constructor will always write to Stdout, but on tests we use a custom BufferString to write. This commit also make some improvements on code organization and private method names. Updates #718 Signed-off-by: Matheus Alcantara <[email protected]>
matheusalcantarazup
force-pushed
the
tests-printressults
branch
from
November 10, 2021 13:40
de4e3c9
to
1cd4596
Compare
wiliansilvazup
changed the title
printresults:chore: add tests to cover output and Sonarqube output type
printresults:chore - add tests to cover output and Sonarqube output type
Nov 10, 2021
lucasbrunozup
approved these changes
Nov 11, 2021
matheusalcantarazup
added a commit
that referenced
this pull request
Dec 1, 2021
On #760 we made an improvement on `getDefaultTotalVulnBySeverity` which reuse the map returned from `getDefaultCountBySeverity` as a value for all keys on the default map of vulnerability severities, but since a map in Go is a pointer we was using the same map to all keys and when we were going to count vulnerabilities by severity, we would update the same pointer for all the keys in that map, which caused inconsistent and duplicated values in the final result. This commit revert this change and call pr.getDefaultCountBySeverity for all keys on this map. Signed-off-by: Matheus Alcantara <[email protected]>
matheusalcantarazup
added a commit
that referenced
this pull request
Dec 1, 2021
On #760 we made an improvement on `getDefaultTotalVulnBySeverity` which reuse the map returned from `getDefaultCountBySeverity` as a value for all keys on the default map of vulnerability severities, but since a map in Go is a pointer we was using the same map to all keys and when we were going to count vulnerabilities by severity, we would update the same pointer for all the keys in that map, which caused inconsistent and duplicated values in the final result. This commit revert this change and call pr.getDefaultCountBySeverity for all keys on this map. The test case was copied and paste with this bug and was also updated. Signed-off-by: Matheus Alcantara <[email protected]>
matheusalcantarazup
added a commit
that referenced
this pull request
Dec 1, 2021
On #760 we made an improvement on `getDefaultTotalVulnBySeverity` which reuse the map returned from `getDefaultCountBySeverity` as a value for all keys on the default map of vulnerability severities, but since a map in Go is a pointer we was using the same map to all keys and when we were going to count vulnerabilities by severity, we would update the same pointer for all the keys in that map, which caused inconsistent and duplicated values in the final result. This commit revert this change and call pr.getDefaultCountBySeverity for all keys on this map. The test case was copied and paste with this bug and was also updated. Signed-off-by: Matheus Alcantara <[email protected]>
matheusalcantarazup
added a commit
that referenced
this pull request
Dec 2, 2021
On #760 we made an improvement on `getDefaultTotalVulnBySeverity` which reuse the map returned from `getDefaultCountBySeverity` as a value for all keys on the default map of vulnerability severities, but since a map in Go is a pointer we was using the same map to all keys and when we were going to count vulnerabilities by severity, we would update the same pointer for all the keys in that map, which caused inconsistent and duplicated values in the final result. This commit revert this change and call pr.getDefaultCountBySeverity for all keys on this map. The test case was copied and paste with this bug and was also updated. Signed-off-by: Matheus Alcantara <[email protected]> (cherry picked from commit f71ca15)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit add new tests to cover Sonarqube output type and add asserts
to check if what was printed is correctly.
The tests was changed to use table testings approach to make more easily
to add a new testcase.
The PrintResults implementation was improved too. Basically a new
io.Writer field was added to customize where we will write outputs. The
default constructor will always write to Stdout, but on tests we use a
custom BufferString to write.
This commit also make some improvements on code organization and private
method names.
Updates #718
Signed-off-by: Matheus Alcantara [email protected]
- What I did
- How to verify it
- Description for the changelog