Commit 61a36b46 authored by Stan Hu's avatar Stan Hu

Test cache methods and expire Wiki caches as well

parent f052560c
......@@ -18,7 +18,7 @@ module EE
# Runs code after a repository has been synced.
def after_sync
expire_all_method_caches
expire_branch_cache
expire_branch_cache if exists?
expire_content_cache
end
......
......@@ -24,6 +24,7 @@ module Geo
fail_registry!('Invalid wiki', e, force_to_redownload_wiki: true)
ensure
clean_up_temporary_repository if redownload
expire_repository_caches
end
def ssh_url_to_wiki
......@@ -38,6 +39,11 @@ module Geo
project.wiki.ensure_repository
end
def expire_repository_caches
log_info('Expiring caches')
repository.after_sync
end
def mark_sync_as_successful
update_registry!(finished_at: DateTime.now, attrs: { last_wiki_sync_failure: nil })
......
......@@ -309,6 +309,7 @@ describe Geo::RepositorySyncService do
force_to_redownload_repository: true
)
expect(project.repository).to receive(:expire_exists_cache).twice.and_call_original
expect(subject).not_to receive(:fail_registry!)
subject.execute
......
......@@ -181,6 +181,7 @@ RSpec.describe Geo::WikiSyncService do
force_to_redownload_wiki: true
)
expect(project.wiki.repository).to receive(:expire_exists_cache).twice.and_call_original
expect(subject).not_to receive(:fail_registry!)
subject.execute
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment