From 3f9c2e0b83531ff540576f64a4fb602f95d62c94 Mon Sep 17 00:00:00 2001 From: Bruno Baumgartner Date: Wed, 3 Jun 2026 12:43:05 +0200 Subject: [PATCH] test: update Core 2.0 basic conformance report fixture to 11 cases --- .../schema/conformance_report_schema_test.go | 30 ++++++++++++ .../report_expected_basic.json | 46 +++++++++++-------- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/internal/schema/conformance_report_schema_test.go b/internal/schema/conformance_report_schema_test.go index 6cd03bd..49044f3 100644 --- a/internal/schema/conformance_report_schema_test.go +++ b/internal/schema/conformance_report_schema_test.go @@ -40,6 +40,36 @@ func TestConformanceReportExampleAndCLIValidateSchema(t *testing.T) { if err := sch.Validate(v); err != nil { t.Fatalf("schema validation failed for example: %v", err) } + exampleReport, ok := v.(map[string]interface{}) + if !ok { + t.Fatalf("unexpected example report shape") + } + if int(exampleReport["total"].(float64)) != 11 { + t.Fatalf("expected example total 11, got %v", exampleReport["total"]) + } + if int(exampleReport["passed"].(float64)) != 11 { + t.Fatalf("expected example passed 11, got %v", exampleReport["passed"]) + } + exampleCases, ok := exampleReport["cases"].([]interface{}) + if !ok || len(exampleCases) != 11 { + t.Fatalf("expected example 11 cases, got %v", exampleReport["cases"]) + } + foundUnsupportedCanonicalizationProfile := false + for _, c := range exampleCases { + caseReport, ok := c.(map[string]interface{}) + if !ok { + t.Fatalf("unexpected example case shape") + } + if caseReport["name"] == "unsupported_canonicalization_profile_error" { + foundUnsupportedCanonicalizationProfile = true + if caseReport["expected_result"] != "ERROR" || caseReport["reason_code"] != "UNSUPPORTED_CANONICALIZATION_PROFILE" { + t.Fatalf("unexpected unsupported canonicalization profile case: %v", caseReport) + } + } + } + if !foundUnsupportedCanonicalizationProfile { + t.Fatalf("missing unsupported_canonicalization_profile_error in example report") + } // Run CLI to produce JSON output and validate ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) diff --git a/testdata/core_2_conformance/report_expected_basic.json b/testdata/core_2_conformance/report_expected_basic.json index ad4cc75..b9d2add 100644 --- a/testdata/core_2_conformance/report_expected_basic.json +++ b/testdata/core_2_conformance/report_expected_basic.json @@ -1,8 +1,8 @@ { "report_version": "core-2-conformance-report-v1", "status": "PASS", - "total": 10, - "passed": 10, + "total": 11, + "passed": 11, "failed": 0, "cases": [ { @@ -19,61 +19,67 @@ "reason_code": "HASH_MISMATCH", "error": null }, + { + "name": "inside_payload_mutation_detected", + "case_passed": true, + "expected_result": "FAIL", + "reason_code": "HASH_MISMATCH", + "error": null + }, { "name": "invalid_schema_error", "case_passed": true, "expected_result": "ERROR", "reason_code": "INVALID_SNAPSHOT_SCHEMA", "error": null - } - , + }, { - "name": "missing_required_field_error", + "name": "malformed_json_error", "case_passed": true, "expected_result": "ERROR", "reason_code": "INVALID_SNAPSHOT_SCHEMA", "error": null }, { - "name": "malformed_json_error", + "name": "missing_required_field_error", "case_passed": true, "expected_result": "ERROR", "reason_code": "INVALID_SNAPSHOT_SCHEMA", "error": null }, { - "name": "unknown_reason_code_error", + "name": "outside_metadata_ignored", "case_passed": true, - "expected_result": "ERROR", - "reason_code": "INTERNAL_ERROR", + "expected_result": "PASS", + "reason_code": "STATE_RECONSTRUCTED", "error": null }, { - "name": "unsupported_hash_algorithm_error", + "name": "unknown_reason_code_error", "case_passed": true, "expected_result": "ERROR", - "reason_code": "UNSUPPORTED_HASH_ALGORITHM", + "reason_code": "INTERNAL_ERROR", "error": null }, { - "name": "wrong_profile_fail", + "name": "unsupported_canonicalization_profile_error", "case_passed": true, - "expected_result": "FAIL", - "reason_code": "RECONSTRUCTION_RULE_MISMATCH", + "expected_result": "ERROR", + "reason_code": "UNSUPPORTED_CANONICALIZATION_PROFILE", "error": null }, { - "name": "inside_payload_mutation_detected", + "name": "unsupported_hash_algorithm_error", "case_passed": true, - "expected_result": "FAIL", - "reason_code": "HASH_MISMATCH", + "expected_result": "ERROR", + "reason_code": "UNSUPPORTED_HASH_ALGORITHM", "error": null }, { - "name": "outside_metadata_ignored", + "name": "wrong_profile_fail", "case_passed": true, - "expected_result": "PASS", - "reason_code": "STATE_RECONSTRUCTED", + "expected_result": "FAIL", + "reason_code": "RECONSTRUCTION_RULE_MISMATCH", "error": null } ]