Commit 52bfca35 authored by Micaël Bergeron's avatar Micaël Bergeron

fix specs added upstream

parent 42abf0f8
...@@ -9,11 +9,11 @@ module EE ...@@ -9,11 +9,11 @@ module EE
prepended do prepended do
after_destroy :log_geo_event after_destroy :log_geo_event
scope :with_files_stored_locally, -> { where(file_store: [nil, JobArtifactUploader::LOCAL_STORE]) } scope :with_files_stored_locally, -> { where(file_store: [nil, JobArtifactUploader::Store::LOCAL]) }
end end
def local_store? def local_store?
[nil, JobArtifactUploader::LOCAL_STORE].include?(self.file_store) [nil, JobArtifactUploader::Store::LOCAL].include?(self.file_store)
end end
private private
......
...@@ -4,7 +4,7 @@ module Geo ...@@ -4,7 +4,7 @@ module Geo
class JobArtifact < ::Geo::BaseFdw class JobArtifact < ::Geo::BaseFdw
self.table_name = Gitlab::Geo.fdw_table('ci_job_artifacts') self.table_name = Gitlab::Geo.fdw_table('ci_job_artifacts')
scope :with_files_stored_locally, -> { where(file_store: [nil, JobArtifactUploader::LOCAL_STORE]) } scope :with_files_stored_locally, -> { where(file_store: [nil, JobArtifactUploader::Store::LOCAL]) }
end end
end end
end end
......
...@@ -3,7 +3,7 @@ module Geo ...@@ -3,7 +3,7 @@ module Geo
class LfsObject < ::Geo::BaseFdw class LfsObject < ::Geo::BaseFdw
self.table_name = Gitlab::Geo.fdw_table('lfs_objects') self.table_name = Gitlab::Geo.fdw_table('lfs_objects')
scope :with_files_stored_locally, -> { where(file_store: [nil, LfsObjectUploader::LOCAL_STORE]) } scope :with_files_stored_locally, -> { where(file_store: [nil, LfsObjectUploader::Store::LOCAL]) }
end end
end end
end end
...@@ -24,7 +24,7 @@ module Geo ...@@ -24,7 +24,7 @@ module Geo
end end
def local_store_path def local_store_path
Pathname.new(JobArtifactUploader.local_store_path) Pathname.new(JobArtifactUploader.root)
end end
def relative_file_path def relative_file_path
......
...@@ -220,7 +220,7 @@ module Gitlab ...@@ -220,7 +220,7 @@ module Gitlab
file_registry_job_artifacts = ::Geo::FileRegistry.job_artifacts.where(file_id: event.job_artifact_id) file_registry_job_artifacts = ::Geo::FileRegistry.job_artifacts.where(file_id: event.job_artifact_id)
return unless file_registry_job_artifacts.any? # avoid race condition return unless file_registry_job_artifacts.any? # avoid race condition
file_path = File.join(JobArtifactUploader.local_store_path, event.file_path) file_path = File.join(JobArtifactUploader.root, event.file_path)
if File.file?(file_path) if File.file?(file_path)
deleted = delete_file(file_path) # delete synchronously to ensure consistency deleted = delete_file(file_path) # delete synchronously to ensure consistency
......
...@@ -100,7 +100,7 @@ FactoryBot.define do ...@@ -100,7 +100,7 @@ FactoryBot.define do
lfs_object { create(:lfs_object, :with_file) } lfs_object { create(:lfs_object, :with_file) }
after(:build, :stub) do |event, _| after(:build, :stub) do |event, _|
local_store_path = Pathname.new(LfsObjectUploader.local_store_path) local_store_path = Pathname.new(LfsObjectUploader.root)
relative_path = Pathname.new(event.lfs_object.file.path).relative_path_from(local_store_path) relative_path = Pathname.new(event.lfs_object.file.path).relative_path_from(local_store_path)
event.oid = event.lfs_object.oid event.oid = event.lfs_object.oid
...@@ -112,7 +112,7 @@ FactoryBot.define do ...@@ -112,7 +112,7 @@ FactoryBot.define do
job_artifact { create(:ci_job_artifact, :archive) } job_artifact { create(:ci_job_artifact, :archive) }
after(:build, :stub) do |event, _| after(:build, :stub) do |event, _|
local_store_path = Pathname.new(JobArtifactUploader.local_store_path) local_store_path = Pathname.new(JobArtifactUploader.root)
relative_path = Pathname.new(event.job_artifact.file.path).relative_path_from(local_store_path) relative_path = Pathname.new(event.job_artifact.file.path).relative_path_from(local_store_path)
event.file_path = relative_path event.file_path = relative_path
......
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