repo: Add OSTREE_REPO_TEST_ERROR=invalid-cache env var

Add an invalid-cache test error flag to ensure that the code that checks
for and recovers from a corrupted summary cache is hit. This helps make
sure that the recovery path is actually used without resorting to
G_MESSAGES_DEBUG.

Closes: #1698
Approved by: cgwalters
This commit is contained in:
Dan Nicholson authored and Atomic Bot committed 2018-08-14 13:38:11 +00:00
1 parent 1b5cb52da2
commit 4e6b13e8b6
4 files changed
+27 -3

No files matched your search

+12 -2
View File
@@ -4037,10 +4037,20 @@ ostree_repo_pull_with_options (OstreeRepo *self,
if (summary_from_cache)
{
/* The cached summary doesn't match, fetch a new one and verify again */
if ((self->test_error_flags & OSTREE_REPO_TEST_ERROR_INVALID_CACHE) > 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Remote %s cached summary invalid and "
"OSTREE_REPO_TEST_ERROR_INVALID_CACHE specified",
pull_data->remote_name);
goto out;
}
else
g_debug ("Remote %s cached summary invalid, pulling new version",
pull_data->remote_name);
summary_from_cache = FALSE;
g_clear_pointer (&bytes_summary, (GDestroyNotify)g_bytes_unref);
g_debug ("Remote %s cached summary invalid, pulling new version",
pull_data->remote_name);
if (!_ostree_fetcher_mirrored_request_to_membuf (pull_data->fetcher,
pull_data->meta_mirrorlist,
"summary",