Skip to content

Commit

Permalink
test(reports): Add a couple of advisor issues to reporter test assets
Browse files Browse the repository at this point in the history
Make the tests cover also unresolved errors, warnings and hints. While
at it, adjust the message of the resolved issue to be more speaking.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Apr 30, 2024
1 parent 9c6b867 commit bf3cb5e
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ issue_resolutions:
reason: "CANT_FIX_ISSUE"
comment: "Resolved for illustration."
- _id: 1
message: "A test issue\\."
message: "Example advisor error, resolved."
reason: "CANT_FIX_ISSUE"
comment: "A comment explaining why the issue can be ignored."
issues:
Expand Down Expand Up @@ -229,13 +229,37 @@ issues:
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "A test issue."
message: "Example advisor error, resolved."
severity: "ERROR"
resolutions:
- 1
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 17
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "Example advisor error."
severity: "ERROR"
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 18
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "Example advisor warning."
severity: "WARNING"
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 19
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "Example advisor hint."
severity: "HINT"
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 20
timestamp: "2024-04-25T07:44:20.725613974Z"
type: "ANALYZER"
source: "Gradle"
Expand All @@ -244,7 +268,7 @@ issues:
pkg: 2
path: 0
how_to_fix: "Some how to fix text."
- _id: 18
- _id: 21
timestamp: "2024-04-25T07:44:20.725613974Z"
type: "ANALYZER"
source: "Gradle"
Expand Down Expand Up @@ -983,7 +1007,7 @@ dependency_trees:
linkage: "DYNAMIC"
pkg: 2
issues:
- 17
- 20
children:
- key: 4
linkage: "DYNAMIC"
Expand All @@ -1008,7 +1032,7 @@ dependency_trees:
linkage: "DYNAMIC"
pkg: 3
issues:
- 18
- 21
children:
- key: 10
linkage: "DYNAMIC"
Expand Down Expand Up @@ -1088,10 +1112,10 @@ statistics:
rule_violation_resolutions: 1
vulnerability_resolutions: 0
open_issues:
errors: 4
warnings: 3
hints: 2
severe: 7
errors: 5
warnings: 4
hints: 3
severe: 9
open_rule_violations:
errors: 1
warnings: 1
Expand Down Expand Up @@ -1182,15 +1206,15 @@ repository_configuration: "---\nexcludes:\n paths:\n - pattern: \"sub/module/p
\n - pattern: \"analyzer/src/funTest/assets/projects/synthetic/gradle/lib/excluded-file.dat\"\
\n reason: \"DATA_FILE_OF\"\n scopes:\n - pattern: \"testCompile\"\n reason:\
\ \"TEST_DEPENDENCY_OF\"\n comment: \"The scope only contains test dependencies.\"\
\nresolutions:\n issues:\n - message: \"A test issue\\\\.\"\n reason: \"CANT_FIX_ISSUE\"\
\n comment: \"A comment explaining why the issue can be ignored.\"\n - message:\
\ \"Example error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\n comment: \"\
Resolved for illustration.\"\n rule_violations:\n - message: \"Apache-2.0 hint\"\
\n reason: \"CANT_FIX_EXCEPTION\"\n comment: \"Apache-2 is not an issue.\"\
\nlicense_choices:\n repository_license_choices:\n - given: \"GPL-2.0-only OR\
\ MIT\"\n choice: \"MIT\"\n package_license_choices:\n - package_id: \"Maven:com.h2database:h2:1.4.200\"\
\n license_choices:\n - given: \"MPL-2.0 OR EPL-1.0\"\n choice: \"MPL-2.0\"\
\n"
\nresolutions:\n issues:\n - message: \"Example advisor error, resolved.\"\n \
\ reason: \"CANT_FIX_ISSUE\"\n comment: \"A comment explaining why the issue\
\ can be ignored.\"\n - message: \"Example error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\
\n comment: \"Resolved for illustration.\"\n rule_violations:\n - message:\
\ \"Apache-2.0 hint\"\n reason: \"CANT_FIX_EXCEPTION\"\n comment: \"Apache-2\
\ is not an issue.\"\nlicense_choices:\n repository_license_choices:\n - given:\
\ \"GPL-2.0-only OR MIT\"\n choice: \"MIT\"\n package_license_choices:\n -\
\ package_id: \"Maven:com.h2database:h2:1.4.200\"\n license_choices:\n - given:\
\ \"MPL-2.0 OR EPL-1.0\"\n choice: \"MPL-2.0\"\n"
labels:
job_parameters.JOB_PARAM_1: "label job param 1"
job_parameters.JOB_PARAM_2: "label job param 2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"comment" : "Resolved for illustration."
}, {
"_id" : 1,
"message" : "A test issue\\.",
"message" : "Example advisor error, resolved.",
"reason" : "CANT_FIX_ISSUE",
"comment" : "A comment explaining why the issue can be ignored."
} ],
Expand Down Expand Up @@ -265,13 +265,40 @@
"timestamp" : "1970-01-01T00:00:00Z",
"type" : "ADVISOR",
"source" : "VulnerableCode",
"message" : "A test issue.",
"message" : "Example advisor error, resolved.",
"severity" : "ERROR",
"resolutions" : [ 1 ],
"pkg" : 2,
"how_to_fix" : "Some how to fix text."
}, {
"_id" : 17,
"timestamp" : "1970-01-01T00:00:00Z",
"type" : "ADVISOR",
"source" : "VulnerableCode",
"message" : "Example advisor error.",
"severity" : "ERROR",
"pkg" : 2,
"how_to_fix" : "Some how to fix text."
}, {
"_id" : 18,
"timestamp" : "1970-01-01T00:00:00Z",
"type" : "ADVISOR",
"source" : "VulnerableCode",
"message" : "Example advisor warning.",
"severity" : "WARNING",
"pkg" : 2,
"how_to_fix" : "Some how to fix text."
}, {
"_id" : 19,
"timestamp" : "1970-01-01T00:00:00Z",
"type" : "ADVISOR",
"source" : "VulnerableCode",
"message" : "Example advisor hint.",
"severity" : "HINT",
"pkg" : 2,
"how_to_fix" : "Some how to fix text."
}, {
"_id" : 20,
"timestamp" : "2024-04-25T07:44:20.725613974Z",
"type" : "ANALYZER",
"source" : "Gradle",
Expand All @@ -281,7 +308,7 @@
"path" : 0,
"how_to_fix" : "Some how to fix text."
}, {
"_id" : 18,
"_id" : 21,
"timestamp" : "2024-04-25T07:44:20.725613974Z",
"type" : "ANALYZER",
"source" : "Gradle",
Expand Down Expand Up @@ -1055,7 +1082,7 @@
"key" : 3,
"linkage" : "DYNAMIC",
"pkg" : 2,
"issues" : [ 17 ],
"issues" : [ 20 ],
"children" : [ {
"key" : 4,
"linkage" : "DYNAMIC",
Expand Down Expand Up @@ -1084,7 +1111,7 @@
"key" : 9,
"linkage" : "DYNAMIC",
"pkg" : 3,
"issues" : [ 18 ],
"issues" : [ 21 ],
"children" : [ {
"key" : 10,
"linkage" : "DYNAMIC",
Expand Down Expand Up @@ -1176,10 +1203,10 @@
"vulnerability_resolutions" : 0
},
"open_issues" : {
"errors" : 4,
"warnings" : 3,
"hints" : 2,
"severe" : 7
"errors" : 5,
"warnings" : 4,
"hints" : 3,
"severe" : 9
},
"open_rule_violations" : {
"errors" : 1,
Expand Down Expand Up @@ -1275,7 +1302,7 @@
},
"severe_issue_threshold" : "WARNING",
"severe_rule_violation_threshold" : "WARNING",
"repository_configuration" : "---\nexcludes:\n paths:\n - pattern: \"sub/module/project/build.gradle\"\n reason: \"EXAMPLE_OF\"\n comment: \"The project is an example.\"\n - pattern: \"**/*.java\"\n reason: \"EXAMPLE_OF\"\n comment: \"These are example files.\"\n - pattern: \"analyzer/src/funTest/assets/projects/synthetic/gradle/lib/excluded-file.dat\"\n reason: \"DATA_FILE_OF\"\n scopes:\n - pattern: \"testCompile\"\n reason: \"TEST_DEPENDENCY_OF\"\n comment: \"The scope only contains test dependencies.\"\nresolutions:\n issues:\n - message: \"A test issue\\\\.\"\n reason: \"CANT_FIX_ISSUE\"\n comment: \"A comment explaining why the issue can be ignored.\"\n - message: \"Example error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\n comment: \"Resolved for illustration.\"\n rule_violations:\n - message: \"Apache-2.0 hint\"\n reason: \"CANT_FIX_EXCEPTION\"\n comment: \"Apache-2 is not an issue.\"\nlicense_choices:\n repository_license_choices:\n - given: \"GPL-2.0-only OR MIT\"\n choice: \"MIT\"\n package_license_choices:\n - package_id: \"Maven:com.h2database:h2:1.4.200\"\n license_choices:\n - given: \"MPL-2.0 OR EPL-1.0\"\n choice: \"MPL-2.0\"\n",
"repository_configuration" : "---\nexcludes:\n paths:\n - pattern: \"sub/module/project/build.gradle\"\n reason: \"EXAMPLE_OF\"\n comment: \"The project is an example.\"\n - pattern: \"**/*.java\"\n reason: \"EXAMPLE_OF\"\n comment: \"These are example files.\"\n - pattern: \"analyzer/src/funTest/assets/projects/synthetic/gradle/lib/excluded-file.dat\"\n reason: \"DATA_FILE_OF\"\n scopes:\n - pattern: \"testCompile\"\n reason: \"TEST_DEPENDENCY_OF\"\n comment: \"The scope only contains test dependencies.\"\nresolutions:\n issues:\n - message: \"Example advisor error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\n comment: \"A comment explaining why the issue can be ignored.\"\n - message: \"Example error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\n comment: \"Resolved for illustration.\"\n rule_violations:\n - message: \"Apache-2.0 hint\"\n reason: \"CANT_FIX_EXCEPTION\"\n comment: \"Apache-2 is not an issue.\"\nlicense_choices:\n repository_license_choices:\n - given: \"GPL-2.0-only OR MIT\"\n choice: \"MIT\"\n package_license_choices:\n - package_id: \"Maven:com.h2database:h2:1.4.200\"\n license_choices:\n - given: \"MPL-2.0 OR EPL-1.0\"\n choice: \"MPL-2.0\"\n",
"labels" : {
"job_parameters.JOB_PARAM_1" : "label job param 1",
"job_parameters.JOB_PARAM_2" : "label job param 2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ issue_resolutions:
reason: "CANT_FIX_ISSUE"
comment: "Resolved for illustration."
- _id: 1
message: "A test issue\\."
message: "Example advisor error, resolved."
reason: "CANT_FIX_ISSUE"
comment: "A comment explaining why the issue can be ignored."
issues:
Expand Down Expand Up @@ -229,13 +229,37 @@ issues:
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "A test issue."
message: "Example advisor error, resolved."
severity: "ERROR"
resolutions:
- 1
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 17
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "Example advisor error."
severity: "ERROR"
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 18
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "Example advisor warning."
severity: "WARNING"
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 19
timestamp: "1970-01-01T00:00:00Z"
type: "ADVISOR"
source: "VulnerableCode"
message: "Example advisor hint."
severity: "HINT"
pkg: 2
how_to_fix: "Some how to fix text."
- _id: 20
timestamp: "2024-04-25T07:44:20.725613974Z"
type: "ANALYZER"
source: "Gradle"
Expand All @@ -244,7 +268,7 @@ issues:
pkg: 2
path: 0
how_to_fix: "Some how to fix text."
- _id: 18
- _id: 21
timestamp: "2024-04-25T07:44:20.725613974Z"
type: "ANALYZER"
source: "Gradle"
Expand Down Expand Up @@ -983,7 +1007,7 @@ dependency_trees:
linkage: "DYNAMIC"
pkg: 2
issues:
- 17
- 20
children:
- key: 4
linkage: "DYNAMIC"
Expand All @@ -1008,7 +1032,7 @@ dependency_trees:
linkage: "DYNAMIC"
pkg: 3
issues:
- 18
- 21
children:
- key: 10
linkage: "DYNAMIC"
Expand Down Expand Up @@ -1088,10 +1112,10 @@ statistics:
rule_violation_resolutions: 1
vulnerability_resolutions: 0
open_issues:
errors: 4
warnings: 3
hints: 2
severe: 7
errors: 5
warnings: 4
hints: 3
severe: 9
open_rule_violations:
errors: 1
warnings: 1
Expand Down Expand Up @@ -1182,15 +1206,15 @@ repository_configuration: "---\nexcludes:\n paths:\n - pattern: \"sub/module/p
\n - pattern: \"analyzer/src/funTest/assets/projects/synthetic/gradle/lib/excluded-file.dat\"\
\n reason: \"DATA_FILE_OF\"\n scopes:\n - pattern: \"testCompile\"\n reason:\
\ \"TEST_DEPENDENCY_OF\"\n comment: \"The scope only contains test dependencies.\"\
\nresolutions:\n issues:\n - message: \"A test issue\\\\.\"\n reason: \"CANT_FIX_ISSUE\"\
\n comment: \"A comment explaining why the issue can be ignored.\"\n - message:\
\ \"Example error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\n comment: \"\
Resolved for illustration.\"\n rule_violations:\n - message: \"Apache-2.0 hint\"\
\n reason: \"CANT_FIX_EXCEPTION\"\n comment: \"Apache-2 is not an issue.\"\
\nlicense_choices:\n repository_license_choices:\n - given: \"GPL-2.0-only OR\
\ MIT\"\n choice: \"MIT\"\n package_license_choices:\n - package_id: \"Maven:com.h2database:h2:1.4.200\"\
\n license_choices:\n - given: \"MPL-2.0 OR EPL-1.0\"\n choice: \"MPL-2.0\"\
\n"
\nresolutions:\n issues:\n - message: \"Example advisor error, resolved.\"\n \
\ reason: \"CANT_FIX_ISSUE\"\n comment: \"A comment explaining why the issue\
\ can be ignored.\"\n - message: \"Example error, resolved.\"\n reason: \"CANT_FIX_ISSUE\"\
\n comment: \"Resolved for illustration.\"\n rule_violations:\n - message:\
\ \"Apache-2.0 hint\"\n reason: \"CANT_FIX_EXCEPTION\"\n comment: \"Apache-2\
\ is not an issue.\"\nlicense_choices:\n repository_license_choices:\n - given:\
\ \"GPL-2.0-only OR MIT\"\n choice: \"MIT\"\n package_license_choices:\n -\
\ package_id: \"Maven:com.h2database:h2:1.4.200\"\n license_choices:\n - given:\
\ \"MPL-2.0 OR EPL-1.0\"\n choice: \"MPL-2.0\"\n"
labels:
job_parameters.JOB_PARAM_1: "label job param 1"
job_parameters.JOB_PARAM_2: "label job param 2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repository:
comment: "The scope only contains test dependencies."
resolutions:
issues:
- message: "A test issue\\."
- message: "Example advisor error, resolved."
reason: "CANT_FIX_ISSUE"
comment: "A comment explaining why the issue can be ignored."
- message: "Example error, resolved."
Expand Down Expand Up @@ -791,8 +791,20 @@ advisor:
issues:
- timestamp: "1970-01-01T00:00:00Z"
source: "VulnerableCode"
message: "A test issue."
message: "Example advisor error, resolved."
severity: "ERROR"
- timestamp: "1970-01-01T00:00:00Z"
source: "VulnerableCode"
message: "Example advisor error."
severity: "ERROR"
- timestamp: "1970-01-01T00:00:00Z"
source: "VulnerableCode"
message: "Example advisor warning."
severity: "WARNING"
- timestamp: "1970-01-01T00:00:00Z"
source: "VulnerableCode"
message: "Example advisor hint."
severity: "HINT"
defects: []
vulnerabilities:
- id: "VULCOID-VULNERABILITY_ID"
Expand Down Expand Up @@ -845,7 +857,7 @@ resolved_configuration:
concluded_license: "MPL-2.0 OR EPL-1.0"
resolutions:
issues:
- message: "A test issue\\."
- message: "Example advisor error, resolved."
reason: "CANT_FIX_ISSUE"
comment: "A comment explaining why the issue can be ignored."
- message: "Example error, resolved."
Expand Down
Loading

0 comments on commit bf3cb5e

Please sign in to comment.