From 1e6c61d08149ff137928bc5b464408bee6263e72 Mon Sep 17 00:00:00 2001 From: Trong Nhan Mai Date: Sun, 11 Feb 2024 16:19:01 +1000 Subject: [PATCH] chore: fix integration tests and improve check tree display in the HTML report --- scripts/dev_scripts/integration_tests.sh | 26 +++---- .../templates/base_template.html | 12 --- .../output_reporter/templates/macaron.html | 28 +++---- ...naut-test_provenance_checks_excluded.json} | 78 ++++++++++--------- 4 files changed, 67 insertions(+), 77 deletions(-) rename tests/e2e/expected_results/{slsa-verifier/slsa-verifier_provenance_checks_excluded.json => micronaut-test/micronaut-test_provenance_checks_excluded.json} (78%) diff --git a/scripts/dev_scripts/integration_tests.sh b/scripts/dev_scripts/integration_tests.sh index e3fc41363..cafc19f7d 100755 --- a/scripts/dev_scripts/integration_tests.sh +++ b/scripts/dev_scripts/integration_tests.sh @@ -289,6 +289,18 @@ do check_or_update_expected_output $COMPARE_JSON_OUT $JSON_RESULT_DIR/$i $JSON_EXPECT_DIR/$i || log_fail done +echo -e "\n----------------------------------------------------------------------------------" +echo "micronaut-projects/micronaut-test: Analyzing the repo path when automatic dependency resolution is skipped" +echo "and all provenance checks are excluded." +echo -e "----------------------------------------------------------------------------------\n" +JSON_RESULT=$WORKSPACE/output/reports/github_com/micronaut-projects/micronaut-test/micronaut-test.json +JSON_EXPECTED=$WORKSPACE/tests/e2e/expected_results/micronaut-test/micronaut-test_provenance_checks_excluded.json +DEFAULTS_FILE=$WORKSPACE/tests/e2e/configurations/exclude_provenance_checks.ini + +$RUN_MACARON -dp $DEFAULTS_FILE analyze -rp https://github.com/micronaut-projects/micronaut-test/ -d 7679d10b4073a3b842b6c56877c35fa8cd10acff --skip-deps || log_fail + +check_or_update_expected_output $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail + # TODO: uncomment the test below after resolving https://github.com/oracle/macaron/issues/60. # echo -e "\n----------------------------------------------------------------------------------" # echo "micronaut-projects/micronaut-test: Check the resolved dependency output with config for cyclonedx gradle plugin (default)." @@ -569,7 +581,7 @@ rm -rf "$SOURCE_REPO" rm -rf "$TARGET_REPO" echo -e "\n----------------------------------------------------------------------------------" -echo "Test running the analysis with all checks excluded." +echo "Running the analysis with all checks excluded should returns an error code." echo -e "----------------------------------------------------------------------------------\n" $RUN_MACARON -dp tests/e2e/configurations/exclude_all_checks.ini analyze -rp https://github.com/apache/maven --skip-deps @@ -626,18 +638,6 @@ then log_fail fi -echo -e "\n----------------------------------------------------------------------------------" -echo "slsa-framework/slsa-verifier: Analyzing the repo path when automatic dependency resolution is skipped" -echo "and provenance checks are excluded." -echo -e "----------------------------------------------------------------------------------\n" -JSON_RESULT=$WORKSPACE/output/reports/github_com/slsa-framework/slsa-verifier/slsa-verifier.json -JSON_EXPECTED=$WORKSPACE/tests/e2e/expected_results/slsa-verifier/slsa-verifier_provenance_checks_excluded.json -DEFAULTS_FILE=$WORKSPACE/tests/e2e/configurations/exclude_provenance_checks.ini - -$RUN_MACARON -dp $DEFAULTS_FILE analyze -rp https://github.com/slsa-framework/slsa-verifier -b main -d fc50b662fcfeeeb0e97243554b47d9b20b14efac --skip-deps || log_fail - -check_or_update_expected_output $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail - # Testing the CUE provenance expectation verifier. echo -e "\n----------------------------------------------------------------------------------" echo "Test verifying CUE provenance expectation." diff --git a/src/macaron/output_reporter/templates/base_template.html b/src/macaron/output_reporter/templates/base_template.html index 36837b402..2da4c24e7 100644 --- a/src/macaron/output_reporter/templates/base_template.html +++ b/src/macaron/output_reporter/templates/base_template.html @@ -293,18 +293,6 @@ display: inline-block; margin-right: 6px; } - - .check-tree-node-excluded { - text-decoration-line: line-through; - } - - .check-tree-node-excluded::before { - content: "\2514"; - color: black; - display: inline-block; - margin-right: 6px; - } - diff --git a/src/macaron/output_reporter/templates/macaron.html b/src/macaron/output_reporter/templates/macaron.html index f6e17c370..d7fec05a5 100644 --- a/src/macaron/output_reporter/templates/macaron.html +++ b/src/macaron/output_reporter/templates/macaron.html @@ -164,24 +164,24 @@ {% endcall %} {% endmacro %} +{# + The `check-tree-node` class will add a small symbol before the check ID + indicating a non-root node. Therefore, we don't apply it for the checks without + parent (i.e the first level checks). +#} {% macro render_run_checks(check_tree, run_checks) %}