Commit 85632be2 authored by Mike Kozono's avatar Mike Kozono

Subsume not_expired scope as well

parent d25b4788
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
module Geo module Geo
class JobArtifactRegistryFinder < FileRegistryFinder class JobArtifactRegistryFinder < FileRegistryFinder
def replicables def replicables
# TODO move not_expired into replicables scope ::Ci::JobArtifact.replicables_for_geo_node
::Ci::JobArtifact.replicables_for_geo_node.not_expired
end end
def syncable def syncable
......
...@@ -75,7 +75,8 @@ module EE ...@@ -75,7 +75,8 @@ module EE
end end
def replicables_for_geo_node(node = ::Gitlab::Geo.current_node) def replicables_for_geo_node(node = ::Gitlab::Geo.current_node)
selective_sync_scope(node).merge(object_storage_scope(node)) not_expired.merge(selective_sync_scope(node))
.merge(object_storage_scope(node))
end end
def object_storage_scope(node) def object_storage_scope(node)
......
...@@ -110,22 +110,31 @@ RSpec.describe Ci::JobArtifact do ...@@ -110,22 +110,31 @@ RSpec.describe Ci::JobArtifact do
# Permutations of sync_object_storage combined with object-stored-artifacts # Permutations of sync_object_storage combined with object-stored-artifacts
# are tested in code, because the logic is simple, and to do it in the table # are tested in code, because the logic is simple, and to do it in the table
# would quadruple its size and have too much duplication. # would quadruple its size and have too much duplication.
where(:selective_sync_namespaces, :selective_sync_shards, :project_factory, :include_expectation) do where(:selective_sync_namespaces, :selective_sync_shards, :factory, :project_factory, :include_expectation) do
nil | nil | [:project] | true nil | nil | [:ci_job_artifact] | [:project] | true
# selective sync by shard # selective sync by shard
nil | :model | [:project] | true nil | :model | [:ci_job_artifact] | [:project] | true
nil | :other | [:project] | false nil | :other | [:ci_job_artifact] | [:project] | false
# selective sync by namespace # selective sync by namespace
:model_parent | nil | [:project] | true :model_parent | nil | [:ci_job_artifact] | [:project] | true
:model_parent_parent | nil | [:project, :in_subgroup] | true :model_parent_parent | nil | [:ci_job_artifact] | [:project, :in_subgroup] | true
:other | nil | [:project] | false :other | nil | [:ci_job_artifact] | [:project] | false
:other | nil | [:project, :in_subgroup] | false :other | nil | [:ci_job_artifact] | [:project, :in_subgroup] | false
# expired
nil | nil | [:ci_job_artifact, :expired] | [:project] | false
# selective sync by shard
nil | :model | [:ci_job_artifact, :expired] | [:project] | false
nil | :other | [:ci_job_artifact, :expired] | [:project] | false
# selective sync by namespace
:model_parent | nil | [:ci_job_artifact, :expired] | [:project] | false
:model_parent_parent | nil | [:ci_job_artifact, :expired] | [:project, :in_subgroup] | false
:other | nil | [:ci_job_artifact, :expired] | [:project] | false
:other | nil | [:ci_job_artifact, :expired] | [:project, :in_subgroup] | false
end end
with_them do with_them do
subject(:job_artifact_included) { described_class.replicables_for_geo_node.include?(ci_job_artifact) } subject(:job_artifact_included) { described_class.replicables_for_geo_node.include?(ci_job_artifact) }
let(:factory) { [:ci_job_artifact]}
let(:project) { create(*project_factory) } let(:project) { create(*project_factory) }
let(:ci_build) { create(:ci_build, project: project) } let(:ci_build) { create(:ci_build, project: project) }
let(:node) do let(:node) do
......
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