Skip to content

Commit 6b48b4e

Browse files
committed
skip skopeo tests in CI for now
1 parent 5345a85 commit 6b48b4e

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

test/e2e-ocl/imagepruner_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func TestImagePruner(t *testing.T) {
5959
t.Parallel()
6060

6161
skipIfUnableToRun(t)
62+
skipIfSkopeoMissingInCI(t)
6263

6364
ctx, cancel := context.WithCancel(context.Background())
6465
t.Cleanup(cancel)
@@ -198,6 +199,13 @@ func TestImagePrunerOnCluster(t *testing.T) {
198199

199200
t.Run("Push image and inspect", func(t *testing.T) {
200201
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+
201209
require.NoError(t, createAndPushScratchImage(ctx, t, pullspec, secretPath, certsDir))
202210
imgPruner := imagepruner.NewImageInspectorDeleter()
203211
sysCtx := &types.SystemContext{DockerCertPath: certsDir, AuthFilePath: secretPath}
@@ -658,6 +666,19 @@ func skipIfUnableToRun(t *testing.T) {
658666
}
659667
}
660668

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+
661682
// Creates a new imagepruner instance with empty creds.
662683
func setupImagePrunerForTestWithEmptyCreds(t *testing.T) (imagepruner.ImagePruner, *corev1.Secret, error) {
663684
// Write an "empty" creds file since we don't actually need creds for this test.

test/helpers/idempotent.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ type IdempotentConfig struct {
5353
SkipOnlyOnFailure bool
5454
// Whether the test failed or not. Private because we set it from testing.T.
5555
testFailed bool
56-
// Whether we're running in CI. Private because we set it using the inCI()
56+
// Whether we're running in CI. Private because we set it using the InCI()
5757
// helper.
5858
inCI bool
5959
}
6060

6161
func (i *IdempotentConfig) shouldRun() bool {
6262
// If skipCleanupAlways is set, then we should not run cleanups regardless of
63-
// outcome. This takes precedence over the inCI() check.
63+
// outcome. This takes precedence over the InCI() check.
6464
if i.SkipAlways {
6565
return false
6666
}
6767

6868
// If the test failed and skipCleanupOnlyAfterFailure is set, we should skip
69-
// cleanup. This takes precedence over the inCI() check.
69+
// cleanup. This takes precedence over the InCI() check.
7070
if i.testFailed && i.SkipOnlyOnFailure {
7171
return false
7272
}
@@ -88,13 +88,13 @@ func (i *IdempotentConfig) shouldRun() bool {
8888
// In CI, we generally don't want to skip cleanups in the event of failure.
8989
func MakeConfigurableIdempotentAndRegister(t TestingT, shouldRunCfg IdempotentConfig, f func()) func() {
9090
shouldRunCfg.testFailed = t.Failed()
91-
shouldRunCfg.inCI = inCI()
91+
shouldRunCfg.inCI = InCI()
9292
return MakeIdempotentSkippableAndRegister(t, shouldRunCfg.shouldRun, f)
9393
}
9494

9595
// Determines if we're running in a CI system based upon the presence (or lack
9696
// thereof) of certain environment variables.
97-
func inCI() bool {
97+
func InCI() bool {
9898
items := []string{
9999
// Specific to OpenShift CI.
100100
"OPENSHIFT_CI",

0 commit comments

Comments
 (0)