summaryrefslogtreecommitdiff
path: root/spec/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /spec/config
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
downloadgitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/config')
-rw-r--r--spec/config/object_store_settings_spec.rb87
-rw-r--r--spec/config/settings_spec.rb2
2 files changed, 79 insertions, 10 deletions
diff --git a/spec/config/object_store_settings_spec.rb b/spec/config/object_store_settings_spec.rb
index 33443509e4a..56ad0943377 100644
--- a/spec/config/object_store_settings_spec.rb
+++ b/spec/config/object_store_settings_spec.rb
@@ -162,14 +162,14 @@ RSpec.describe ObjectStoreSettings do
{
'enabled' => true,
'remote_directory' => 'some-bucket',
- 'direct_upload' => true,
- 'background_upload' => false,
+ 'direct_upload' => false,
+ 'background_upload' => true,
'proxy_download' => false
}
end
before do
- settings.lfs['object_store'] = described_class.legacy_parse(legacy_settings)
+ settings.lfs['object_store'] = described_class.legacy_parse(legacy_settings, 'lfs')
end
it 'does not alter config if legacy settings are specified' do
@@ -177,6 +177,35 @@ RSpec.describe ObjectStoreSettings do
expect(settings.artifacts['object_store']).to be_nil
expect(settings.lfs['object_store']['remote_directory']).to eq('some-bucket')
+ # Disable background_upload, regardless of the input config
+ expect(settings.lfs['object_store']['direct_upload']).to eq(true)
+ expect(settings.lfs['object_store']['background_upload']).to eq(false)
+ expect(settings.external_diffs['object_store']).to be_nil
+ end
+ end
+
+ context 'with legacy config and legacy background upload is enabled' do
+ let(:legacy_settings) do
+ {
+ 'enabled' => true,
+ 'remote_directory' => 'some-bucket',
+ 'proxy_download' => false
+ }
+ end
+
+ before do
+ stub_env(ObjectStoreSettings::LEGACY_BACKGROUND_UPLOADS_ENV, 'lfs')
+ settings.lfs['object_store'] = described_class.legacy_parse(legacy_settings, 'lfs')
+ end
+
+ it 'enables background_upload and disables direct_upload' do
+ subject
+
+ expect(settings.artifacts['object_store']).to be_nil
+ expect(settings.lfs['object_store']['remote_directory']).to eq('some-bucket')
+ # Enable background_upload if the environment variable is available
+ expect(settings.lfs['object_store']['direct_upload']).to eq(false)
+ expect(settings.lfs['object_store']['background_upload']).to eq(true)
expect(settings.external_diffs['object_store']).to be_nil
end
end
@@ -185,11 +214,11 @@ RSpec.describe ObjectStoreSettings do
describe '.legacy_parse' do
it 'sets correct default values' do
- settings = described_class.legacy_parse(nil)
+ settings = described_class.legacy_parse(nil, 'artifacts')
expect(settings['enabled']).to be false
- expect(settings['direct_upload']).to be false
- expect(settings['background_upload']).to be true
+ expect(settings['direct_upload']).to be true
+ expect(settings['background_upload']).to be false
expect(settings['remote_directory']).to be nil
end
@@ -199,12 +228,52 @@ RSpec.describe ObjectStoreSettings do
'remote_directory' => 'artifacts'
})
- settings = described_class.legacy_parse(original_settings)
+ settings = described_class.legacy_parse(original_settings, 'artifacts')
expect(settings['enabled']).to be true
- expect(settings['direct_upload']).to be false
- expect(settings['background_upload']).to be true
+ expect(settings['direct_upload']).to be true
+ expect(settings['background_upload']).to be false
expect(settings['remote_directory']).to eq 'artifacts'
end
+
+ context 'legacy background upload environment variable is enabled' do
+ before do
+ stub_env(ObjectStoreSettings::LEGACY_BACKGROUND_UPLOADS_ENV, 'artifacts,lfs')
+ end
+
+ it 'enables background_upload and disables direct_upload' do
+ original_settings = Settingslogic.new({
+ 'enabled' => true,
+ 'remote_directory' => 'artifacts'
+ })
+
+ settings = described_class.legacy_parse(original_settings, 'artifacts')
+
+ expect(settings['enabled']).to be true
+ expect(settings['direct_upload']).to be false
+ expect(settings['background_upload']).to be true
+ expect(settings['remote_directory']).to eq 'artifacts'
+ end
+ end
+
+ context 'legacy background upload environment variable is enabled for other types' do
+ before do
+ stub_env(ObjectStoreSettings::LEGACY_BACKGROUND_UPLOADS_ENV, 'uploads,lfs')
+ end
+
+ it 'enables direct_upload and disables background_upload' do
+ original_settings = Settingslogic.new({
+ 'enabled' => true,
+ 'remote_directory' => 'artifacts'
+ })
+
+ settings = described_class.legacy_parse(original_settings, 'artifacts')
+
+ expect(settings['enabled']).to be true
+ expect(settings['direct_upload']).to be true
+ expect(settings['background_upload']).to be false
+ expect(settings['remote_directory']).to eq 'artifacts'
+ end
+ end
end
end
diff --git a/spec/config/settings_spec.rb b/spec/config/settings_spec.rb
index 0c2465678f9..1de0e7e6c26 100644
--- a/spec/config/settings_spec.rb
+++ b/spec/config/settings_spec.rb
@@ -118,7 +118,7 @@ RSpec.describe Settings do
allow(Gitlab::CurrentSettings)
.to receive(:uuid) { 'd9e2f4e8-db1f-4e51-b03d-f427e1965c4a'}
- expect(described_class.send(:cron_for_service_ping)).to eq('21 18 * * 4')
+ expect(described_class.send(:cron_for_service_ping)).to eq('44 10 * * 4')
end
it 'returns min, hour, day in the valid range' do