summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-04-20 08:57:28 -0400
committerGitHub <noreply@github.com>2021-04-20 08:57:28 -0400
commit0fcf4a3f3019a960c0213c33cec9f2cd06400231 (patch)
tree3a35f3f166ee0494f003e72bd3cdf7c5d108bc71
parent2458df446f65083df6ef4580b69839045c5985ed (diff)
parente660855796a40ad417d13cbe081bd62e56a1c6f5 (diff)
downloadostree-0fcf4a3f3019a960c0213c33cec9f2cd06400231.tar.gz
Merge pull request #2352 from dbnicholson/skip-summary-cache-envvar
tests: Test without a cache directory by default
-rw-r--r--src/libostree/ostree-repo.c2
-rwxr-xr-xtests/libtest.sh5
-rwxr-xr-xtests/test-pull-summary-caching.sh3
-rwxr-xr-xtests/test-pull-summary-sigs.sh3
-rwxr-xr-xtests/test-signed-pull-summary.sh3
5 files changed, 15 insertions, 1 deletions
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index b2347b47..76b02482 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -3291,7 +3291,7 @@ ostree_repo_open (OstreeRepo *self,
if (!glnx_opendirat (self->repo_dir_fd, "tmp", TRUE, &self->tmp_dir_fd, error))
return FALSE;
- if (self->writable)
+ if (self->writable && getenv ("OSTREE_SKIP_CACHE") == NULL)
{
if (!glnx_shutil_mkdir_p_at (self->tmp_dir_fd, _OSTREE_CACHE_DIR, DEFAULT_DIRECTORY_MODE, cancellable, error))
return FALSE;
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 2e9a99df..40f362be 100755
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -86,6 +86,11 @@ unset TAR_OPTIONS
# easily clean up.
export OSTREE_SYSROOT_DEBUG=mutable-deployments
+# By default, don't use a cache directory since it makes the tests racy.
+# Tests that are explicitly testing the cache operation should unset
+# this.
+export OSTREE_SKIP_CACHE=1
+
export TEST_GPG_KEYID_1="7FCA23D8472CDAFA"
export TEST_GPG_KEYFPR_1="5E65DE75AB1C501862D476347FCA23D8472CDAFA"
export TEST_GPG_KEYID_2="D8228CFECA950D41"
diff --git a/tests/test-pull-summary-caching.sh b/tests/test-pull-summary-caching.sh
index 9671199a..37c2aed6 100755
--- a/tests/test-pull-summary-caching.sh
+++ b/tests/test-pull-summary-caching.sh
@@ -31,6 +31,9 @@ if ! has_gpgme; then
exit 0
fi
+# Ensure repo caching is in use.
+unset OSTREE_SKIP_CACHE
+
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
echo "1..1"
diff --git a/tests/test-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh
index 3819cbf3..04a8e488 100755
--- a/tests/test-pull-summary-sigs.sh
+++ b/tests/test-pull-summary-sigs.sh
@@ -23,6 +23,9 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
+# Ensure repo caching is in use.
+unset OSTREE_SKIP_CACHE
+
COMMIT_SIGN=""
if has_gpgme; then
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
diff --git a/tests/test-signed-pull-summary.sh b/tests/test-signed-pull-summary.sh
index e953f2ea..3d468693 100755
--- a/tests/test-signed-pull-summary.sh
+++ b/tests/test-signed-pull-summary.sh
@@ -27,6 +27,9 @@ set -euo pipefail
echo "1..14"
+# Ensure repo caching is in use.
+unset OSTREE_SKIP_CACHE
+
# This is explicitly opt in for testing
export OSTREE_DUMMY_SIGN_ENABLED=1