Commit 95a270c8 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Fix repository reloading in some specs

parent 47d3ea01
...@@ -478,6 +478,10 @@ class Project < ActiveRecord::Base ...@@ -478,6 +478,10 @@ class Project < ActiveRecord::Base
@repository ||= Repository.new(full_path, self, disk_path: disk_path) @repository ||= Repository.new(full_path, self, disk_path: disk_path)
end end
def reload_repository!
@repository = nil
end
def container_registry_url def container_registry_url
if Gitlab.config.registry.enabled if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{full_path.downcase}" "#{Gitlab.config.registry.host_port}/#{full_path.downcase}"
......
...@@ -47,11 +47,11 @@ module Storage ...@@ -47,11 +47,11 @@ module Storage
project.send_move_instructions(old_path_with_namespace) 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) SystemHooksService.new.execute_hooks_for(project, :rename)
@repository = nil project.reload_repository!
rescue => e rescue => e
Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}" Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}"
# Returning false does not rollback after_* transaction but gives # Returning false does not rollback after_* transaction but gives
......
...@@ -52,11 +52,11 @@ module Storage ...@@ -52,11 +52,11 @@ module Storage
project.send_move_instructions(old_path_with_namespace) project.send_move_instructions(old_path_with_namespace)
project.expires_full_path_cache 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) SystemHooksService.new.execute_hooks_for(project, :rename)
@repository = nil project.reload_repository!
rescue => e rescue => e
Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}" Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}"
# Returning false does not rollback after_* transaction but gives # Returning false does not rollback after_* transaction but gives
......
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