@@ -438,6 +438,39 @@ _attestation_v1_with_metadata(build_finished_on, tasks) := {"statement": {
438438 },
439439}}
440440
441+ # Helper to create SLSA v1.0 attestation with spec-compliant finishedOn
442+ _attestation_v1_with_finished_on (finished_on, tasks) := {" statement" : {
443+ " predicateType" : " https://slsa.dev/provenance/v1" ,
444+ " predicate" : {
445+ " buildDefinition" : {
446+ " buildType" : lib.tekton_slsav1_pipeline_run,
447+ " externalParameters" : {" runSpec" : {" pipelineSpec" : {}}},
448+ " resolvedDependencies" : array.concat (tekton_test.resolved_dependencies (tasks), _mock_materials),
449+ },
450+ " runDetails" : {" metadata" : {
451+ " finishedOn" : finished_on,
452+ " startedOn" : " 2025-01-01T00:00:00Z" ,
453+ }},
454+ },
455+ }}
456+
457+ test_pipelinerun_attestations_single_v1_finished_on if {
458+ # Single v1.0 attestation using spec-compliant finishedOn - should be returned
459+ att := _attestation_v1_with_finished_on (" 2025-01-20T15:45:00Z" , [_build_task])
460+ expected := [att]
461+ assertions.assert_equal (expected, lib.pipelinerun_attestations) with input .attestations as [att]
462+ }
463+
464+ test_pipelinerun_attestations_multiple_v1_finished_on if {
465+ # Multiple v1.0 attestations using spec-compliant finishedOn - should return the latest
466+ att1 := _attestation_v1_with_finished_on (" 2025-01-15T10:30:00Z" , [_build_task])
467+ att2 := _attestation_v1_with_finished_on (" 2025-01-20T15:45:00Z" , [_build_task])
468+ att3 := _attestation_v1_with_finished_on (" 2025-01-18T12:00:00Z" , [_build_task])
469+ attestations := [att1, att2, att3]
470+ expected := [att2]
471+ assertions.assert_equal (expected, lib.pipelinerun_attestations) with input .attestations as attestations
472+ }
473+
441474test_pipelinerun_attestations_single_v02 if {
442475 # Test single v0.2 attestation
443476 att := _attestation_v02_with_metadata (" 2025-01-15T10:30:00Z" , [_build_task])
0 commit comments