Fix repository reloading in some specs

This commit is contained in:
Gabriel Mazetto 2017-08-08 11:53:52 +02:00
parent 47d3ea01bb
commit 95a270c871
3 changed files with 8 additions and 4 deletions

View File

@ -478,6 +478,10 @@ class Project < ActiveRecord::Base
@repository ||= Repository.new(full_path, self, disk_path: disk_path)
end
def reload_repository!
@repository = nil
end
def container_registry_url
if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{full_path.downcase}"

View File

@ -47,11 +47,11 @@ module Storage
project.send_move_instructions(old_path_with_namespace)
@old_path_with_namespace = old_path_with_namespace
project.old_path_with_namespace = old_path_with_namespace
SystemHooksService.new.execute_hooks_for(project, :rename)
@repository = nil
project.reload_repository!
rescue => e
Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}"
# Returning false does not rollback after_* transaction but gives

View File

@ -52,11 +52,11 @@ module Storage
project.send_move_instructions(old_path_with_namespace)
project.expires_full_path_cache
@old_path_with_namespace = old_path_with_namespace
project.old_path_with_namespace = old_path_with_namespace
SystemHooksService.new.execute_hooks_for(project, :rename)
@repository = nil
project.reload_repository!
rescue => e
Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}"
# Returning false does not rollback after_* transaction but gives