diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-12 13:17:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-12 13:17:34 +0300 |
commit | 3a6238c2e23454c462ccd229b1802583e657bfd0 (patch) | |
tree | 808c1151b9916516e41cea4869791cbf3dab345f /spec/lib | |
parent | c301cf0ca5fbb998c22be5d8033e77be4bf0a451 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/database/migration_helpers_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/command_line_util_spec.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/url_blocker_spec.rb | 44 |
3 files changed, 47 insertions, 2 deletions
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index d71a4f81901..9505da8fd12 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -2211,7 +2211,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do job_class_name: 'CopyColumnUsingBackgroundMigrationJob', table_name: :events, column_name: :id, - job_arguments: [["id"], ["id_convert_to_bigint"]] + job_arguments: [["id"], ["id_convert_to_bigint"], nil] } end @@ -2226,7 +2226,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do "\n\n" \ "Finalize it manualy by running" \ "\n\n" \ - "\tsudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[[\"id\"]\\, [\"id_convert_to_bigint\"]]']" \ + "\tsudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[[\"id\"]\\,[\"id_convert_to_bigint\"]\\,null]']" \ "\n\n" \ "For more information, check the documentation" \ "\n\n" \ diff --git a/spec/lib/gitlab/import_export/command_line_util_spec.rb b/spec/lib/gitlab/import_export/command_line_util_spec.rb index f5913da08ba..59d97357045 100644 --- a/spec/lib/gitlab/import_export/command_line_util_spec.rb +++ b/spec/lib/gitlab/import_export/command_line_util_spec.rb @@ -167,6 +167,7 @@ RSpec.describe Gitlab::ImportExport::CommandLineUtil do context 'for object_storage uri' do let(:enabled_object_storage_setting) do { + 'enabled' => true, 'object_store' => { 'enabled' => true, diff --git a/spec/lib/gitlab/url_blocker_spec.rb b/spec/lib/gitlab/url_blocker_spec.rb index 57b0297a0a0..8f505606e04 100644 --- a/spec/lib/gitlab/url_blocker_spec.rb +++ b/spec/lib/gitlab/url_blocker_spec.rb @@ -43,6 +43,7 @@ RSpec.describe Gitlab::UrlBlocker, :stub_invalid_dns_only do let(:import_url) { "#{host}/external-diffs/merge_request_diffs/mr-1/diff-1" } let(:enabled_object_storage_setting) do { + 'enabled' => true, 'object_store' => { 'enabled' => true, @@ -81,6 +82,49 @@ RSpec.describe Gitlab::UrlBlocker, :stub_invalid_dns_only do let(:expected_hostname) { nil } end end + + context 'when LFS object storage is enabled' do + let(:lfs_config) do + { + 'enabled' => lfs_enabled, + # This nesting of Settingslogic is necessary to trigger the bug + 'object_store' => Settingslogic.new({ 'enabled' => true }) + } + end + + let(:config) do + { + 'gitlab' => Gitlab.config.gitlab, + 'repositories' => { 'storages' => { 'default' => 'test' } }, + 'lfs' => Settingslogic.new(lfs_config) + } + end + + let(:host) { 'http://127.0.0.1:9000' } + let(:settings) { Settingslogic.new(config) } + + before do + allow(Gitlab).to receive(:config).and_return(settings) + # Triggers Settingslogic bug: https://gitlab.com/gitlab-org/gitlab/-/issues/286873 + settings.repositories.storages.default + end + + context 'when LFS is disabled' do + let(:lfs_enabled) { false } + + it 'raises an error' do + expect { subject }.to raise_error(described_class::BlockedUrlError) + end + end + + context 'when LFS is enabled with no connection endpoint' do + let(:lfs_enabled) { true } + + it 'raises an error' do + expect { subject }.to raise_error(described_class::BlockedUrlError) + end + end + end end context 'when allow_object_storage is false' do |