diff options
author | Dan Nicholson <dbn@endlessos.org> | 2021-04-19 11:00:20 -0600 |
---|---|---|
committer | Dan Nicholson <dbn@endlessos.org> | 2021-04-19 11:09:44 -0600 |
commit | e660855796a40ad417d13cbe081bd62e56a1c6f5 (patch) | |
tree | 3a35f3f166ee0494f003e72bd3cdf7c5d108bc71 /src/libostree/ostree-repo.c | |
parent | 2458df446f65083df6ef4580b69839045c5985ed (diff) | |
download | ostree-e660855796a40ad417d13cbe081bd62e56a1c6f5.tar.gz |
tests: Test without a cache directory by default
Several tests generate summaries and then expect to use the generated
summary immediately. However, this can cause intermittent test failures
when they inadvertantly get a cached summary file. This typically
happens when the test is run on a filesystem that doesn't support user
extended attributes. In that case, the caching code can only use the
last modified time, which only has 1 second granularity. If tests don't
carefully manage the summary modification times or the repo cache then
they are likely subject to races in some test environments.
This introduces an environment variable `OSTREE_SKIP_CACHE` that
prevents the repo from using a cache directory. This is enabled by
default in tests and disabled for tests that are a explicitly trying to
test the caching behavior.
Fixes: #2313
Fixes: #2351
Diffstat (limited to 'src/libostree/ostree-repo.c')
-rw-r--r-- | src/libostree/ostree-repo.c | 2 |
1 files changed, 1 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; |