Commit 6001c02c authored by Luke Duncalfe's avatar Luke Duncalfe

Put Designs in LFS feature behind feature flag

Flag is disabled by default. This is because Design Management is
pre-MVC so will only be used internally at GitLab, and by default we
want to prevent designs being stored in LFS until we can track which
LFS objects are for design repositories (see comment
https://gitlab.com/gitlab-org/gitlab-ee/issues/9490#note_155912249)

https://gitlab.com/gitlab-org/gitlab-ee/issues/9490
parent 9eda7aa1
......@@ -99,6 +99,8 @@ module DesignManagement
end
def file_content(file, full_path)
return file.to_io if Feature.disabled?(:store_designs_in_lfs)
transformer = Lfs::FileTransformer.new(project, target_branch)
transformer.new_file(full_path, file.to_io).content
end
......
......@@ -134,11 +134,30 @@ describe DesignManagement::SaveDesignsService do
context 'when LFS is enabled' do
before do
allow(project).to receive(:lfs_enabled?).and_return(true)
allow_any_instance_of(Lfs::FileTransformer).to receive(:lfs_file?).and_return(true)
end
it 'saves the design to LFS' do
expect { service.execute }.to change { LfsObject.count }.by(1)
context 'and the `store_designs_in_lfs` feature is enabled' do
before do
stub_feature_flags(store_designs_in_lfs: true)
expect_next_instance_of(Lfs::FileTransformer) do |transformer|
expect(transformer).to receive(:lfs_file?).and_return(true)
end
end
it 'saves the design to LFS' do
expect { service.execute }.to change { LfsObject.count }.by(1)
end
end
context 'and the `store_designs_in_lfs` feature is not enabled' do
before do
stub_feature_flags(store_designs_in_lfs: false)
end
it 'does not save the design to LFS' do
expect { service.execute }.not_to change { LfsObject.count }
end
end
end
......
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