@@ -70,6 +70,13 @@ func extractDockerMetadataFromCache(cacheBundleFN string) (*DockerImageMetadata,
7070 return nil , fmt .Errorf ("docker-export-metadata.json not found in cache bundle" )
7171}
7272
73+ // TestDockerPackage_ExportToCache_Integration verifies OCI layout export functionality.
74+ // Tests three scenarios:
75+ // 1. Legacy push behavior (exportToCache=false) - pushes to registry
76+ // 2. New OCI export (exportToCache=true) - creates image.tar in cache
77+ // 3. Export without image config - extracts container filesystem
78+ //
79+ // SLSA relevance: Validates that exportToCache creates OCI layout required for SLSA L3.
7380func TestDockerPackage_ExportToCache_Integration (t * testing.T ) {
7481 if testing .Short () {
7582 t .Skip ("Skipping integration test in short mode" )
@@ -344,6 +351,10 @@ func listTarGzContents(path string) ([]string, error) {
344351 return files , nil
345352}
346353
354+ // TestDockerPackage_CacheRoundTrip_Integration verifies the complete cache workflow:
355+ // Build with OCI export → Cache → Restore → Load into Docker → Verify image works
356+ //
357+ // SLSA relevance: Validates end-to-end cache workflow required for SLSA L3 compliance.
347358func TestDockerPackage_CacheRoundTrip_Integration (t * testing.T ) {
348359 if testing .Short () {
349360 t .Skip ("Skipping integration test in short mode" )
@@ -593,6 +604,11 @@ CMD ["cat", "/test-file.txt"]`
593604 t .Log ("✅ Round-trip test passed: image exported, cached, extracted, loaded, and executed successfully" )
594605}
595606
607+ // TestDockerPackage_OCILayout_Determinism_Integration verifies deterministic builds with OCI layout.
608+ // Builds the same package twice and compares SHA256 hashes of the resulting image.tar files.
609+ //
610+ // SLSA relevance: CRITICAL for SLSA L3 - deterministic builds enable reproducible builds
611+ // and build provenance verification. This validates that OCI layout export is deterministic.
596612func TestDockerPackage_OCILayout_Determinism_Integration (t * testing.T ) {
597613 if testing .Short () {
598614 t .Skip ("Skipping integration test in short mode" )
@@ -811,8 +827,16 @@ func checksumFile(path string) (string, error) {
811827 return fmt .Sprintf ("%x" , h .Sum (nil )), nil
812828}
813829
814- // TestDockerPackage_OCILayout_SLSA_Integration tests that SLSA provenance generation
815- // works correctly with OCI layout export (regression test for docker inspect bug)
830+ // TestDockerPackage_OCILayout_SLSA_Integration is the PRIMARY SLSA L3 TEST.
831+ // Tests end-to-end SLSA provenance generation with OCI layout export:
832+ // - Workspace with provenance.slsa: true
833+ // - Package with exportToCache: true
834+ // - Build creates OCI layout (image.tar)
835+ // - SLSA provenance generation succeeds
836+ // - Digest extracted from index.json (not docker inspect)
837+ //
838+ // This validates the exact workflow used in production SLSA L3 builds.
839+ // Regression test for the docker inspect bug where digest extraction failed with OCI layout.
816840func TestDockerPackage_OCILayout_SLSA_Integration (t * testing.T ) {
817841 if testing .Short () {
818842 t .Skip ("Skipping integration test in short mode" )
@@ -1007,7 +1031,13 @@ CMD ["cat", "/build-time.txt"]
10071031}
10081032
10091033// TestDockerPackage_ContainerExtraction_Integration tests container filesystem extraction
1010- // with both Docker daemon and OCI layout paths
1034+ // with both Docker daemon and OCI layout paths. Validates the fix for checkOCILayoutExists().
1035+ //
1036+ // Tests two scenarios:
1037+ // 1. with_docker_daemon (exportToCache=false) - uses docker image inspect
1038+ // 2. with_oci_layout (exportToCache=true) - uses checkOCILayoutExists()
1039+ //
1040+ // SLSA relevance: Ensures packages that extract files from Docker images work with SLSA L3 caching.
10111041func TestDockerPackage_ContainerExtraction_Integration (t * testing.T ) {
10121042 if testing .Short () {
10131043 t .Skip ("Skipping integration test in short mode" )
0 commit comments