@@ -25,6 +25,7 @@ import (
2525 "github.com/google/go-containerregistry/pkg/registry"
2626 "github.com/google/go-containerregistry/pkg/v1/random"
2727 "github.com/google/go-containerregistry/pkg/v1/remote"
28+ cosignclean "github.com/sigstore/cosign/v2/cmd/cosign/cli"
2829 cosignoptions "github.com/sigstore/cosign/v2/cmd/cosign/cli/options"
2930 ociremote "github.com/sigstore/cosign/v2/pkg/oci/remote"
3031)
@@ -100,7 +101,7 @@ func TestCleanImageCleanTypeAllRemovesAllTags(t *testing.T) {
100101 t .Fatal ("signature tag should exist before clean" )
101102 }
102103
103- if err := cleanImage (context .Background (), regOpts , cosignoptions .CleanTypeAll , imageRef ); err != nil {
104+ if err := cosignclean . CleanCmd (context .Background (), regOpts , cosignoptions .CleanTypeAll , imageRef , true ); err != nil {
104105 t .Fatalf ("cleanImage: %v" , err )
105106 }
106107
@@ -130,7 +131,7 @@ func TestCleanImageCleanTypeAttestationLeavesSignatureTag(t *testing.T) {
130131 pushDummyImage (t , attTag , remoteOpts )
131132 pushDummyImage (t , sigTag , remoteOpts )
132133
133- if err := cleanImage (context .Background (), regOpts , cosignoptions .CleanTypeAttestation , imageRef ); err != nil {
134+ if err := cosignclean . CleanCmd (context .Background (), regOpts , cosignoptions .CleanTypeAttestation , imageRef , true ); err != nil {
134135 t .Fatalf ("cleanImage: %v" , err )
135136 }
136137
@@ -160,7 +161,7 @@ func TestCleanImageCleanTypeSignatureLeavesAttestationTag(t *testing.T) {
160161 pushDummyImage (t , attTag , remoteOpts )
161162 pushDummyImage (t , sigTag , remoteOpts )
162163
163- if err := cleanImage (context .Background (), regOpts , cosignoptions .CleanTypeSignature , imageRef ); err != nil {
164+ if err := cosignclean . CleanCmd (context .Background (), regOpts , cosignoptions .CleanTypeSignature , imageRef , true ); err != nil {
164165 t .Fatalf ("cleanImage: %v" , err )
165166 }
166167
@@ -179,7 +180,7 @@ func TestCleanImageNoTagsDoesNotError(t *testing.T) {
179180 pushBaseImage (t , imageRef , remoteOpts )
180181
181182 // no attestation/signature tags present — clean should still succeed
182- if err := cleanImage (context .Background (), regOpts , cosignoptions .CleanTypeAll , imageRef ); err != nil {
183+ if err := cosignclean . CleanCmd (context .Background (), regOpts , cosignoptions .CleanTypeAll , imageRef , true ); err != nil {
183184 t .Fatalf ("cleanImage on image with no sig/att tags failed: %v" , err )
184185 }
185186}
0 commit comments