From 8a4b7c5af85557db80527477fe242382705dc929 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 13 Apr 2023 12:16:27 +0200 Subject: [PATCH] Add testenv.UsingSnapshotter utility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To allow skipping integration tests that don't apply to the containerd snapshotter. Signed-off-by: Sebastiaan van Stijn Signed-off-by: Paweł Gronowski (cherry picked from commit 43735478577eff35687434d5134bc5d536e6647e) Signed-off-by: Paweł Gronowski --- testutil/environment/environment.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testutil/environment/environment.go b/testutil/environment/environment.go index 7007008fec..fda7cf1265 100644 --- a/testutil/environment/environment.go +++ b/testutil/environment/environment.go @@ -193,6 +193,13 @@ func (e *Execution) IsUserNamespaceInKernel() bool { return true } +// UsingSnapshotter returns whether containerd snapshotters are used for the +// tests by checking if the "TEST_INTEGRATION_USE_SNAPSHOTTER" is set to a +// non-empty value. +func (e *Execution) UsingSnapshotter() bool { + return os.Getenv("TEST_INTEGRATION_USE_SNAPSHOTTER") != "" +} + // HasExistingImage checks whether there is an image with the given reference. // Note that this is done by filtering and then checking whether there were any // results -- so ambiguous references might result in false-positives.