@@ -59,6 +59,7 @@ func TestImagePruner(t *testing.T) {
59
59
t .Parallel ()
60
60
61
61
skipIfUnableToRun (t )
62
+ skipIfSkopeoMissingInCI (t )
62
63
63
64
ctx , cancel := context .WithCancel (context .Background ())
64
65
t .Cleanup (cancel )
@@ -198,6 +199,13 @@ func TestImagePrunerOnCluster(t *testing.T) {
198
199
199
200
t .Run ("Push image and inspect" , func (t * testing.T ) {
200
201
t .Parallel ()
202
+
203
+ // This test requires skopeo which is missing in the CI environment. It is
204
+ // possible to customize the CI environment by using a different image, but
205
+ // doing so tweaking openshift/release configs and adding another
206
+ // Dockerfile.
207
+ skipIfSkopeoMissingInCI (t )
208
+
201
209
require .NoError (t , createAndPushScratchImage (ctx , t , pullspec , secretPath , certsDir ))
202
210
imgPruner := imagepruner .NewImageInspectorDeleter ()
203
211
sysCtx := & types.SystemContext {DockerCertPath : certsDir , AuthFilePath : secretPath }
@@ -658,6 +666,19 @@ func skipIfUnableToRun(t *testing.T) {
658
666
}
659
667
}
660
668
669
+ // Determines if the test should be skipped in CI because the skopeo binary is
670
+ // missing. We skip this for now because getting the skopeo binary into the CI
671
+ // test environment is a bit involved.
672
+ func skipIfSkopeoMissingInCI (t * testing.T ) {
673
+ if _ , err := exec .LookPath ("skopeo" ); err != nil {
674
+ if helpers .InCI () {
675
+ t .Skip ("Skipping because of missing skopeo binary" )
676
+ } else {
677
+ t .Fatalf ("Skopeo binary missing; did you install it?" )
678
+ }
679
+ }
680
+ }
681
+
661
682
// Creates a new imagepruner instance with empty creds.
662
683
func setupImagePrunerForTestWithEmptyCreds (t * testing.T ) (imagepruner.ImagePruner , * corev1.Secret , error ) {
663
684
// Write an "empty" creds file since we don't actually need creds for this test.
0 commit comments